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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f2931385fc82cbf3dab46e73684d7270ff1db0e04420b5f94dde420ee6afb52
|
4
|
+
data.tar.gz: e51728ade938225112b94e702eb1f5de3072a09cd99ed44882c56e337df65d7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19e245c7ba5fa776897ce78c57876ae473e0ae30710861acc55d552c372df59481289049137c3d141143db5e996eabc1a7a335a384e867903ba2d7134365e27e
|
7
|
+
data.tar.gz: df02367000aab8e3fb6d883fd85e06cd463c4ac2c49ba5150849b8e65691635036864bcc887a4b771d5782eed729c157142feb0e8c799ef07c1d15548eb39319
|
data/elastic_record.gemspec
CHANGED
data/lib/elastic_record/index.rb
CHANGED
@@ -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,
|
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}/#{
|
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,
|
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}/#{
|
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,
|
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}/#{
|
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'
|
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,
|
90
|
+
{index: {_index: index.alias_name, _id: "5"}},
|
91
91
|
{color: "green"},
|
92
|
-
{update: {_index: "widgets",
|
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,
|
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,
|
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.
|
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-
|
12
|
+
date: 2019-08-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: arelastic
|