elastic_record 5.6.0 → 5.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c916b053e2c2a228b4da081dad0b380dfcd7aea05c3f970134d25f68b9c9a72
4
- data.tar.gz: 7fa353180b59dcc3fafa81a1e4d6def1d1873b1748079c1d676d38458ea7ba78
3
+ metadata.gz: 4f2931385fc82cbf3dab46e73684d7270ff1db0e04420b5f94dde420ee6afb52
4
+ data.tar.gz: e51728ade938225112b94e702eb1f5de3072a09cd99ed44882c56e337df65d7f
5
5
  SHA512:
6
- metadata.gz: aadbe8c69f0a39e70d0cafc2bc77785cfabb1ffec23b5480eb6269cfd7cac955ff6761a2c3d375f68f0d1b625c4e09de89d7913ac84a347161fac3895d4242f1
7
- data.tar.gz: 642e51f60c39f3102a4c716b60e3c0ec84c89b5d75ed5828c06f73934c61eebb9a0e19892a0ffa12bdc966b7c0b46608f2337ec522b333929d3ba574d0b49678
6
+ metadata.gz: 19e245c7ba5fa776897ce78c57876ae473e0ae30710861acc55d552c372df59481289049137c3d141143db5e996eabc1a7a335a384e867903ba2d7134365e27e
7
+ data.tar.gz: df02367000aab8e3fb6d883fd85e06cd463c4ac2c49ba5150849b8e65691635036864bcc887a4b771d5782eed729c157142feb0e8c799ef07c1d15548eb39319
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'elastic_record'
5
- s.version = '5.6.0'
5
+ s.version = '5.6.1'
6
6
  s.summary = 'An Elasticsearch querying ORM'
7
7
  s.description = 'Find your records with Elasticsearch'
8
8
 
@@ -89,7 +89,7 @@ module ElasticRecord
89
89
 
90
90
  def get(end_path, json = nil)
91
91
  path = "/#{alias_name}"
92
- path += "/#{mapping_type}"
92
+ path += "/#{mapping_type}" if custom_mapping_type_name?
93
93
  path += "/#{end_path}"
94
94
 
95
95
  connection.json_get path, json
@@ -25,13 +25,13 @@ module ElasticRecord
25
25
 
26
26
  def index_document(id, document, parent: nil, index_name: alias_name)
27
27
  if batch = current_bulk_batch
28
- instructions = { _index: index_name, _type: mapping_type, _id: id }
28
+ instructions = { _index: index_name, _id: id }
29
29
  instructions[:parent] = parent if parent
30
30
 
31
31
  batch << { index: instructions }
32
32
  batch << document
33
33
  else
34
- path = "/#{index_name}/#{mapping_type}/#{id}"
34
+ path = "/#{index_name}/_doc/#{id}"
35
35
  path << "?parent=#{parent}" if parent
36
36
 
37
37
  if id
@@ -47,13 +47,13 @@ module ElasticRecord
47
47
  params = {doc: document, doc_as_upsert: true}
48
48
 
49
49
  if batch = current_bulk_batch
50
- instructions = { _index: index_name, _type: mapping_type, _id: id, retry_on_conflict: 3 }
50
+ instructions = { _index: index_name, _id: id, retry_on_conflict: 3 }
51
51
  instructions[:parent] = parent if parent
52
52
 
53
53
  batch << { update: instructions }
54
54
  batch << params
55
55
  else
56
- path = "/#{index_name}/#{mapping_type}/#{id}/_update?retry_on_conflict=3"
56
+ path = "/#{index_name}/_doc/#{id}/_update?retry_on_conflict=3"
57
57
  path << "&parent=#{parent}" if parent
58
58
 
59
59
  connection.json_post path, params
@@ -65,11 +65,11 @@ module ElasticRecord
65
65
  index_name ||= alias_name
66
66
 
67
67
  if batch = current_bulk_batch
68
- instructions = { _index: index_name, _type: mapping_type, _id: id, retry_on_conflict: 3 }
68
+ instructions = { _index: index_name, _id: id, retry_on_conflict: 3 }
69
69
  instructions[:parent] = parent if parent
70
70
  batch << { delete: instructions }
71
71
  else
72
- path = "/#{index_name}/#{mapping_type}/#{id}"
72
+ path = "/#{index_name}/_doc/#{id}"
73
73
  path << "&parent=#{parent}" if parent
74
74
 
75
75
  connection.json_delete path
@@ -49,7 +49,7 @@ class ElasticRecord::Index::DocumentsTest < MiniTest::Test
49
49
  index.update_document('abc', color: 'blue')
50
50
 
51
51
  expected = {'warehouse_id' => '5', 'color' => 'blue'}
52
- assert_equal expected, index.get('abc', index.mapping_type)['_source']
52
+ assert_equal expected, index.get('abc')['_source']
53
53
 
54
54
  assert_raises RuntimeError do
55
55
  index.update_document(nil, color: 'blue')
@@ -87,11 +87,11 @@ class ElasticRecord::Index::DocumentsTest < MiniTest::Test
87
87
  index.delete_document '3'
88
88
 
89
89
  expected = [
90
- {index: {_index: index.alias_name, _type: "widget", _id: "5"}},
90
+ {index: {_index: index.alias_name, _id: "5"}},
91
91
  {color: "green"},
92
- {update: {_index: "widgets", _type: "widget", _id: "5", retry_on_conflict: 3}},
92
+ {update: {_index: "widgets", _id: "5", retry_on_conflict: 3}},
93
93
  {doc: {color: "blue"}, doc_as_upsert: true},
94
- {delete: {_index: index.alias_name, _type: "widget", _id: "3", retry_on_conflict: 3}}
94
+ {delete: {_index: index.alias_name, _id: "3", retry_on_conflict: 3}}
95
95
  ]
96
96
  assert_equal expected, index.current_bulk_batch
97
97
  end
@@ -151,7 +151,7 @@ class ElasticRecord::Index::DocumentsTest < MiniTest::Test
151
151
  InheritedWidget.elastic_index.index_document '5', color: 'green'
152
152
 
153
153
  expected = [
154
- {index: {_index: index.alias_name, _type: "widget", _id: "5"}},
154
+ {index: {_index: index.alias_name, _id: "5"}},
155
155
  {color: "green"}
156
156
  ]
157
157
  assert_equal expected, index.current_bulk_batch
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastic_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.6.0
4
+ version: 5.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Infogroup
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-08-02 00:00:00.000000000 Z
12
+ date: 2019-08-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: arelastic