elastic_search_framework 2.3.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/elastic_search_framework/index.rb +2 -2
- data/lib/elastic_search_framework/index_alias.rb +2 -2
- data/lib/elastic_search_framework/version.rb +1 -1
- data/spec/elastic_search_framework/index_alias_spec.rb +20 -4
- data/spec/elastic_search_framework/index_spec.rb +18 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 660bab65bf91d16e1788d6f43c47e979ab70d6367b6d964c5db5edb2fd94405e
|
4
|
+
data.tar.gz: 6132de6d0f951d36382e1d5023eb1b22240b66df004192f291434dae80284ff4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35187a0efc4484e04f90db902db59fe7f599e83986ff16621c8b554bcc35c0d54167fc8663e11bb53d8048088707e31bf3fc191f5dcb970eaa244ebe7daeed7b
|
7
|
+
data.tar.gz: 82da0e555366738552a4bb4c522e0c6a4d31d83e82e3f4774851d2fc0ac72f291bcf351aa0e2012e31cfaf3058be8b9b1d1cacf8750ec85da5b84db72b89e5f9
|
@@ -172,8 +172,8 @@ module ElasticSearchFramework
|
|
172
172
|
repository.get(index: self, id: id, type: type)
|
173
173
|
end
|
174
174
|
|
175
|
-
def put_item(type: 'default', item:)
|
176
|
-
repository.set(entity: item, index: self, type: type)
|
175
|
+
def put_item(type: 'default', item:, op_type: 'index')
|
176
|
+
repository.set(entity: item, index: self, type: type, op_type: op_type)
|
177
177
|
end
|
178
178
|
|
179
179
|
def delete_item(id:, type: 'default')
|
@@ -127,9 +127,9 @@ module ElasticSearchFramework
|
|
127
127
|
repository.get(index: self, id: id, type: type)
|
128
128
|
end
|
129
129
|
|
130
|
-
def put_item(type: "default", item:)
|
130
|
+
def put_item(type: "default", item:, op_type: 'index')
|
131
131
|
indexes.each do |index|
|
132
|
-
repository.set(entity: item, index: index[:klass], type: type)
|
132
|
+
repository.set(entity: item, index: index[:klass], type: type, op_type: op_type)
|
133
133
|
end
|
134
134
|
end
|
135
135
|
|
@@ -125,10 +125,26 @@ RSpec.describe ElasticSearchFramework::Index do
|
|
125
125
|
i.number = 5
|
126
126
|
end
|
127
127
|
end
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
128
|
+
context 'without specifying op_type' do
|
129
|
+
it 'should call set on the repository for each index of the alias with default op_type (index)' do
|
130
|
+
expect(ExampleIndexAlias.repository).to receive(:set).with(entity: item, index: ExampleIndex, type: type, op_type: 'index').once
|
131
|
+
expect(ExampleIndexAlias.repository).to receive(:set).with(entity: item, index: ExampleIndex2, type: type, op_type: 'index').once
|
132
|
+
ExampleIndexAlias.put_item(type: type, item: item)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
context 'with specified op_type' do
|
137
|
+
it 'should call set on the repository for each index of the alias with supplied op_type (index)' do
|
138
|
+
expect(ExampleIndexAlias.repository).to receive(:set).with(entity: item, index: ExampleIndex, type: type, op_type: 'index').once
|
139
|
+
expect(ExampleIndexAlias.repository).to receive(:set).with(entity: item, index: ExampleIndex2, type: type, op_type: 'index').once
|
140
|
+
ExampleIndexAlias.put_item(type: type, item: item, op_type: 'index')
|
141
|
+
end
|
142
|
+
|
143
|
+
it 'should call set on the repository for each index of the alias with supplied op_type (create)' do
|
144
|
+
expect(ExampleIndexAlias.repository).to receive(:set).with(entity: item, index: ExampleIndex, type: type, op_type: 'create').once
|
145
|
+
expect(ExampleIndexAlias.repository).to receive(:set).with(entity: item, index: ExampleIndex2, type: type, op_type: 'create').once
|
146
|
+
ExampleIndexAlias.put_item(type: type, item: item, op_type: 'create')
|
147
|
+
end
|
132
148
|
end
|
133
149
|
end
|
134
150
|
|
@@ -301,9 +301,24 @@ RSpec.describe ElasticSearchFramework::Index do
|
|
301
301
|
i.number = 5
|
302
302
|
end
|
303
303
|
end
|
304
|
-
|
305
|
-
|
306
|
-
|
304
|
+
|
305
|
+
context 'without specifying op_type' do
|
306
|
+
it 'should call set on the repository with default op_type (index)' do
|
307
|
+
expect_any_instance_of(ElasticSearchFramework::Repository).to receive(:set).with(entity: item, index: ExampleIndex, op_type: 'index', type: type)
|
308
|
+
ExampleIndex.put_item(type: type, item: item)
|
309
|
+
end
|
310
|
+
end
|
311
|
+
|
312
|
+
context 'with specified op_type' do
|
313
|
+
it 'should call set on the repository with supplied op_type (index)' do
|
314
|
+
expect_any_instance_of(ElasticSearchFramework::Repository).to receive(:set).with(entity: item, index: ExampleIndex, op_type: 'index', type: type)
|
315
|
+
ExampleIndex.put_item(type: type, item: item, op_type: 'index')
|
316
|
+
end
|
317
|
+
|
318
|
+
it 'should call set on the repository with supplied op_type (create)' do
|
319
|
+
expect_any_instance_of(ElasticSearchFramework::Repository).to receive(:set).with(entity: item, index: ExampleIndex, op_type: 'create', type: type)
|
320
|
+
ExampleIndex.put_item(type: type, item: item, op_type: 'create')
|
321
|
+
end
|
307
322
|
end
|
308
323
|
end
|
309
324
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elastic_search_framework
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vaughanbrittonsage
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-05-
|
11
|
+
date: 2021-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|