elasticsearch-model 6.1.1 → 7.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/Gemfile +18 -1
- data/LICENSE.txt +199 -10
- data/README.md +44 -45
- data/Rakefile +24 -10
- data/elasticsearch-model.gemspec +54 -39
- data/examples/activerecord_article.rb +17 -0
- data/examples/activerecord_associations.rb +33 -0
- data/examples/activerecord_custom_analyzer.rb +17 -0
- data/examples/activerecord_mapping_completion.rb +17 -0
- data/examples/activerecord_mapping_edge_ngram.rb +17 -0
- data/examples/couchbase_article.rb +17 -0
- data/examples/datamapper_article.rb +17 -0
- data/examples/mongoid_article.rb +17 -0
- data/examples/ohm_article.rb +17 -0
- data/examples/riak_article.rb +17 -0
- data/gemfiles/3.0.gemfile +18 -1
- data/gemfiles/4.0.gemfile +18 -1
- data/gemfiles/5.0.gemfile +18 -1
- data/gemfiles/6.0.gemfile +21 -3
- data/lib/elasticsearch/model.rb +25 -60
- data/lib/elasticsearch/model/adapter.rb +17 -0
- data/lib/elasticsearch/model/adapters/active_record.rb +17 -0
- data/lib/elasticsearch/model/adapters/default.rb +17 -0
- data/lib/elasticsearch/model/adapters/mongoid.rb +17 -0
- data/lib/elasticsearch/model/adapters/multiple.rb +29 -4
- data/lib/elasticsearch/model/callbacks.rb +17 -0
- data/lib/elasticsearch/model/client.rb +17 -0
- data/lib/elasticsearch/model/ext/active_record.rb +17 -0
- data/lib/elasticsearch/model/hash_wrapper.rb +17 -0
- data/lib/elasticsearch/model/importing.rb +60 -16
- data/lib/elasticsearch/model/indexing.rb +69 -43
- data/lib/elasticsearch/model/multimodel.rb +17 -0
- data/lib/elasticsearch/model/naming.rb +19 -19
- data/lib/elasticsearch/model/proxy.rb +58 -21
- data/lib/elasticsearch/model/response.rb +17 -0
- data/lib/elasticsearch/model/response/aggregations.rb +17 -0
- data/lib/elasticsearch/model/response/base.rb +22 -1
- data/lib/elasticsearch/model/response/pagination.rb +17 -0
- data/lib/elasticsearch/model/response/pagination/kaminari.rb +17 -0
- data/lib/elasticsearch/model/response/pagination/will_paginate.rb +17 -0
- data/lib/elasticsearch/model/response/records.rb +17 -1
- data/lib/elasticsearch/model/response/result.rb +17 -0
- data/lib/elasticsearch/model/response/results.rb +17 -0
- data/lib/elasticsearch/model/response/suggestions.rb +17 -0
- data/lib/elasticsearch/model/searching.rb +17 -0
- data/lib/elasticsearch/model/serializing.rb +17 -0
- data/lib/elasticsearch/model/version.rb +18 -1
- data/spec/elasticsearch/model/adapter_spec.rb +17 -0
- data/spec/elasticsearch/model/adapters/active_record/associations_spec.rb +17 -0
- data/spec/elasticsearch/model/adapters/active_record/basic_spec.rb +281 -226
- data/spec/elasticsearch/model/adapters/active_record/dynamic_index_name_spec.rb +17 -0
- data/spec/elasticsearch/model/adapters/active_record/import_spec.rb +18 -12
- data/spec/elasticsearch/model/adapters/active_record/multi_model_spec.rb +17 -0
- data/spec/elasticsearch/model/adapters/active_record/namespaced_model_spec.rb +18 -1
- data/spec/elasticsearch/model/adapters/active_record/pagination_spec.rb +17 -0
- data/spec/elasticsearch/model/adapters/active_record/parent_child_spec.rb +18 -1
- data/spec/elasticsearch/model/adapters/active_record/serialization_spec.rb +17 -0
- data/spec/elasticsearch/model/adapters/active_record_spec.rb +17 -0
- data/spec/elasticsearch/model/adapters/default_spec.rb +17 -0
- data/spec/elasticsearch/model/adapters/mongoid/basic_spec.rb +17 -0
- data/spec/elasticsearch/model/adapters/mongoid/multi_model_spec.rb +28 -11
- data/spec/elasticsearch/model/adapters/mongoid_spec.rb +17 -0
- data/spec/elasticsearch/model/adapters/multiple_spec.rb +17 -0
- data/spec/elasticsearch/model/callbacks_spec.rb +17 -0
- data/spec/elasticsearch/model/client_spec.rb +17 -0
- data/spec/elasticsearch/model/hash_wrapper_spec.rb +17 -0
- data/spec/elasticsearch/model/importing_spec.rb +29 -0
- data/spec/elasticsearch/model/indexing_spec.rb +111 -15
- data/spec/elasticsearch/model/module_spec.rb +18 -25
- data/spec/elasticsearch/model/multimodel_spec.rb +17 -0
- data/spec/elasticsearch/model/naming_spec.rb +22 -5
- data/spec/elasticsearch/model/proxy_spec.rb +17 -0
- data/spec/elasticsearch/model/response/aggregations_spec.rb +17 -0
- data/spec/elasticsearch/model/response/base_spec.rb +17 -0
- data/spec/elasticsearch/model/response/pagination/kaminari_spec.rb +85 -23
- data/spec/elasticsearch/model/response/pagination/will_paginate_spec.rb +17 -0
- data/spec/elasticsearch/model/response/records_spec.rb +17 -0
- data/spec/elasticsearch/model/response/response_spec.rb +17 -0
- data/spec/elasticsearch/model/response/result_spec.rb +17 -0
- data/spec/elasticsearch/model/response/results_spec.rb +17 -0
- data/spec/elasticsearch/model/searching_search_request_spec.rb +17 -0
- data/spec/elasticsearch/model/searching_spec.rb +17 -0
- data/spec/elasticsearch/model/serializing_spec.rb +17 -0
- data/spec/spec_helper.rb +37 -5
- data/spec/support/app.rb +27 -2
- data/spec/support/app/answer.rb +17 -0
- data/spec/support/app/article.rb +17 -0
- data/spec/support/app/article_for_pagination.rb +17 -0
- data/spec/support/app/article_no_type.rb +37 -0
- data/spec/support/app/article_with_custom_serialization.rb +17 -0
- data/spec/support/app/article_with_dynamic_index_name.rb +17 -0
- data/spec/support/app/author.rb +17 -0
- data/spec/support/app/authorship.rb +17 -0
- data/spec/support/app/category.rb +17 -0
- data/spec/support/app/comment.rb +17 -0
- data/spec/support/app/episode.rb +17 -0
- data/spec/support/app/image.rb +17 -0
- data/spec/support/app/import_article.rb +17 -0
- data/spec/support/app/mongoid_article.rb +17 -0
- data/spec/support/app/namespaced_book.rb +17 -0
- data/spec/support/app/parent_and_child_searchable.rb +21 -4
- data/spec/support/app/post.rb +17 -0
- data/spec/support/app/question.rb +17 -0
- data/spec/support/app/searchable.rb +17 -0
- data/spec/support/app/series.rb +17 -0
- metadata +46 -46
- data/spec/elasticsearch/model/naming_inheritance_spec.rb +0 -184
@@ -1,3 +1,20 @@
|
|
1
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
2
|
+
# license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright
|
4
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
+
# not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
|
1
18
|
require 'spec_helper'
|
2
19
|
|
3
20
|
describe Elasticsearch::Model::HashWrapper, if: Hashie::VERSION >= '3.5.3' do
|
@@ -1,3 +1,20 @@
|
|
1
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
2
|
+
# license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright
|
4
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
+
# not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
|
1
18
|
require 'spec_helper'
|
2
19
|
|
3
20
|
describe Elasticsearch::Model::Importing do
|
@@ -210,5 +227,17 @@ describe Elasticsearch::Model::Importing do
|
|
210
227
|
end
|
211
228
|
end
|
212
229
|
end
|
230
|
+
|
231
|
+
context 'when a pipeline is provided as an options' do
|
232
|
+
|
233
|
+
before do
|
234
|
+
expect(DummyImportingModel).to receive(:client).and_return(client)
|
235
|
+
expect(client).to receive(:bulk).with(body: nil, index: 'foo', type: 'foo', pipeline: 'my-pipeline').and_return(response)
|
236
|
+
end
|
237
|
+
|
238
|
+
it 'uses the pipeline option' do
|
239
|
+
expect(DummyImportingModel.import(pipeline: 'my-pipeline')).to eq(0)
|
240
|
+
end
|
241
|
+
end
|
213
242
|
end
|
214
243
|
end
|
@@ -1,3 +1,20 @@
|
|
1
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
2
|
+
# license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright
|
4
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
+
# not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
|
1
18
|
require 'spec_helper'
|
2
19
|
|
3
20
|
describe Elasticsearch::Model::Indexing do
|
@@ -84,10 +101,8 @@ describe Elasticsearch::Model::Indexing do
|
|
84
101
|
expect(DummyIndexingModel.mappings).to be_a(Elasticsearch::Model::Indexing::Mappings)
|
85
102
|
end
|
86
103
|
|
87
|
-
it '
|
88
|
-
expect
|
89
|
-
Elasticsearch::Model::Indexing::Mappings.new
|
90
|
-
}.to raise_exception(ArgumentError)
|
104
|
+
it 'does not raise an exception when there is no type passed to the #initialize method' do
|
105
|
+
expect(Elasticsearch::Model::Indexing::Mappings.new)
|
91
106
|
end
|
92
107
|
|
93
108
|
it 'should be convertible to a hash' do
|
@@ -98,7 +113,7 @@ describe Elasticsearch::Model::Indexing do
|
|
98
113
|
expect(Elasticsearch::Model::Indexing::Mappings.new(:mytype, { foo: 'bar' }).as_json).to eq(expected_mapping_hash)
|
99
114
|
end
|
100
115
|
|
101
|
-
context 'when
|
116
|
+
context 'when a type is specified' do
|
102
117
|
|
103
118
|
let(:mappings) do
|
104
119
|
Elasticsearch::Model::Indexing::Mappings.new(:mytype)
|
@@ -113,6 +128,65 @@ describe Elasticsearch::Model::Indexing do
|
|
113
128
|
expect(mappings.to_hash[:mytype][:properties][:foo][:type]).to eq('boolean')
|
114
129
|
end
|
115
130
|
|
131
|
+
it 'uses text as the default field type' do
|
132
|
+
expect(mappings.to_hash[:mytype][:properties][:bar][:type]).to eq('text')
|
133
|
+
end
|
134
|
+
|
135
|
+
context 'when the \'include_type_name\' option is specified' do
|
136
|
+
|
137
|
+
let(:mappings) do
|
138
|
+
Elasticsearch::Model::Indexing::Mappings.new(:mytype, include_type_name: true)
|
139
|
+
end
|
140
|
+
|
141
|
+
before do
|
142
|
+
mappings.indexes :foo, { type: 'boolean', include_in_all: false }
|
143
|
+
end
|
144
|
+
|
145
|
+
it 'creates the correct mapping definition' do
|
146
|
+
expect(mappings.to_hash[:mytype][:properties][:foo][:type]).to eq('boolean')
|
147
|
+
end
|
148
|
+
|
149
|
+
it 'sets the \'include_type_name\' option' do
|
150
|
+
expect(mappings.to_hash[:mytype][:include_type_name]).to eq(true)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
context 'when a type is not specified' do
|
156
|
+
|
157
|
+
let(:mappings) do
|
158
|
+
Elasticsearch::Model::Indexing::Mappings.new
|
159
|
+
end
|
160
|
+
|
161
|
+
before do
|
162
|
+
mappings.indexes :foo, { type: 'boolean', include_in_all: false }
|
163
|
+
mappings.indexes :bar
|
164
|
+
end
|
165
|
+
|
166
|
+
it 'creates the correct mapping definition' do
|
167
|
+
expect(mappings.to_hash[:properties][:foo][:type]).to eq('boolean')
|
168
|
+
end
|
169
|
+
|
170
|
+
it 'uses text as the default type' do
|
171
|
+
expect(mappings.to_hash[:properties][:bar][:type]).to eq('text')
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
context 'when specific mappings are defined' do
|
176
|
+
|
177
|
+
let(:mappings) do
|
178
|
+
Elasticsearch::Model::Indexing::Mappings.new(:mytype, include_type_name: true)
|
179
|
+
end
|
180
|
+
|
181
|
+
before do
|
182
|
+
mappings.indexes :foo, { type: 'boolean', include_in_all: false }
|
183
|
+
mappings.indexes :bar
|
184
|
+
end
|
185
|
+
|
186
|
+
it 'creates the correct mapping definition' do
|
187
|
+
expect(mappings.to_hash[:mytype][:properties][:foo][:type]).to eq('boolean')
|
188
|
+
end
|
189
|
+
|
116
190
|
it 'uses text as the default type' do
|
117
191
|
expect(mappings.to_hash[:mytype][:properties][:bar][:type]).to eq('text')
|
118
192
|
end
|
@@ -169,6 +243,10 @@ describe Elasticsearch::Model::Indexing do
|
|
169
243
|
expect(mappings.to_hash[:mytype][:properties][:foo_nested_as_symbol][:properties]).not_to be_nil
|
170
244
|
expect(mappings.to_hash[:mytype][:properties][:foo_nested_as_symbol][:fields]).to be_nil
|
171
245
|
end
|
246
|
+
|
247
|
+
it 'defines the settings' do
|
248
|
+
expect(mappings.to_hash[:mytype][:include_type_name]).to be(true)
|
249
|
+
end
|
172
250
|
end
|
173
251
|
end
|
174
252
|
|
@@ -180,7 +258,7 @@ describe Elasticsearch::Model::Indexing do
|
|
180
258
|
end
|
181
259
|
|
182
260
|
let(:expected_mappings_hash) do
|
183
|
-
{
|
261
|
+
{ foo: "boo", bar: "bam", properties: {} }
|
184
262
|
end
|
185
263
|
|
186
264
|
it 'sets the mappings' do
|
@@ -196,7 +274,25 @@ describe Elasticsearch::Model::Indexing do
|
|
196
274
|
end
|
197
275
|
|
198
276
|
it 'sets the mappings' do
|
199
|
-
expect(DummyIndexingModel.mapping.to_hash[:
|
277
|
+
expect(DummyIndexingModel.mapping.to_hash[:properties][:foo][:type]).to eq('boolean')
|
278
|
+
end
|
279
|
+
end
|
280
|
+
|
281
|
+
context 'when the class has a document_type' do
|
282
|
+
|
283
|
+
before do
|
284
|
+
DummyIndexingModel.instance_variable_set(:@mapping, nil)
|
285
|
+
DummyIndexingModel.document_type(:mytype)
|
286
|
+
DummyIndexingModel.mappings(foo: 'boo')
|
287
|
+
DummyIndexingModel.mappings(bar: 'bam')
|
288
|
+
end
|
289
|
+
|
290
|
+
let(:expected_mappings_hash) do
|
291
|
+
{ mytype: { foo: "boo", bar: "bam", properties: {} } }
|
292
|
+
end
|
293
|
+
|
294
|
+
it 'sets the mappings' do
|
295
|
+
expect(DummyIndexingModel.mappings.to_hash).to eq(expected_mappings_hash)
|
200
296
|
end
|
201
297
|
end
|
202
298
|
end
|
@@ -322,7 +418,7 @@ describe Elasticsearch::Model::Indexing do
|
|
322
418
|
expect(instance).to receive(:client).and_return(client)
|
323
419
|
expect(instance).to receive(:as_indexed_json).and_return('JSON')
|
324
420
|
expect(instance).to receive(:index_name).and_return('foo')
|
325
|
-
expect(instance).to receive(:document_type).and_return('bar')
|
421
|
+
expect(instance).to receive(:document_type).twice.and_return('bar')
|
326
422
|
expect(instance).to receive(:id).and_return('1')
|
327
423
|
end
|
328
424
|
|
@@ -362,7 +458,7 @@ describe Elasticsearch::Model::Indexing do
|
|
362
458
|
before do
|
363
459
|
expect(instance).to receive(:client).and_return(client)
|
364
460
|
expect(instance).to receive(:index_name).and_return('foo')
|
365
|
-
expect(instance).to receive(:document_type).and_return('bar')
|
461
|
+
expect(instance).to receive(:document_type).twice.and_return('bar')
|
366
462
|
expect(instance).to receive(:id).and_return('1')
|
367
463
|
end
|
368
464
|
|
@@ -506,7 +602,7 @@ describe Elasticsearch::Model::Indexing do
|
|
506
602
|
before do
|
507
603
|
expect(instance).to receive(:client).and_return(client)
|
508
604
|
expect(instance).to receive(:index_name).and_return('foo')
|
509
|
-
expect(instance).to receive(:document_type).and_return('bar')
|
605
|
+
expect(instance).to receive(:document_type).twice.and_return('bar')
|
510
606
|
expect(instance).to receive(:id).and_return('1')
|
511
607
|
instance.instance_variable_set(:@__changed_model_attributes, { author: 'john' })
|
512
608
|
end
|
@@ -738,8 +834,8 @@ describe Elasticsearch::Model::Indexing do
|
|
738
834
|
context 'when options are not provided' do
|
739
835
|
|
740
836
|
let(:expected_body) do
|
741
|
-
{ mappings: {
|
742
|
-
type: 'text' } } }
|
837
|
+
{ mappings: { properties: { foo: { analyzer: 'keyword',
|
838
|
+
type: 'text' } } },
|
743
839
|
settings: { index: { number_of_shards: 1 } } }
|
744
840
|
end
|
745
841
|
|
@@ -789,8 +885,8 @@ describe Elasticsearch::Model::Indexing do
|
|
789
885
|
|
790
886
|
before do
|
791
887
|
expect(DummyIndexingModelForCreate).to receive(:client).and_return(client)
|
792
|
-
expect(DummyIndexingModelForCreate).to receive(:index_exists?).and_return(false)
|
793
888
|
expect(DummyIndexingModelForCreate).to receive(:delete_index!).and_return(true)
|
889
|
+
expect(DummyIndexingModelForCreate).to receive(:index_exists?).and_return(false)
|
794
890
|
expect(indices).to receive(:create).and_raise(Exception)
|
795
891
|
end
|
796
892
|
|
@@ -810,8 +906,8 @@ describe Elasticsearch::Model::Indexing do
|
|
810
906
|
end
|
811
907
|
|
812
908
|
let(:expected_body) do
|
813
|
-
{ mappings: {
|
814
|
-
type: 'text' } } }
|
909
|
+
{ mappings: { properties: { foo: { analyzer: 'keyword',
|
910
|
+
type: 'text' } } },
|
815
911
|
settings: { index: { number_of_shards: 1 } } }
|
816
912
|
end
|
817
913
|
|
@@ -1,3 +1,20 @@
|
|
1
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
2
|
+
# license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright
|
4
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
+
# not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
|
1
18
|
require 'spec_helper'
|
2
19
|
|
3
20
|
describe Elasticsearch::Model do
|
@@ -31,6 +48,7 @@ describe Elasticsearch::Model do
|
|
31
48
|
end
|
32
49
|
|
33
50
|
DummyIncludingModel.__send__ :include, Elasticsearch::Model
|
51
|
+
DummyIncludingModelWithSearchMethodDefined.__send__ :include, Elasticsearch::Model
|
34
52
|
end
|
35
53
|
|
36
54
|
after(:all) do
|
@@ -72,30 +90,5 @@ describe Elasticsearch::Model do
|
|
72
90
|
expect(Elasticsearch::Model.settings[:foo]).to eq('bar')
|
73
91
|
end
|
74
92
|
end
|
75
|
-
|
76
|
-
context 'when \'inheritance_enabled\' is set' do
|
77
|
-
|
78
|
-
around do |example|
|
79
|
-
original_value = Elasticsearch::Model.settings[:inheritance_enabled]
|
80
|
-
example.run
|
81
|
-
Elasticsearch::Model.settings[:inheritance_enabled] = original_value
|
82
|
-
end
|
83
|
-
|
84
|
-
context 'when \'inheritance_enabled\' is true' do
|
85
|
-
|
86
|
-
it 'warns with a deprecation message' do
|
87
|
-
expect(Elasticsearch::Model).to receive(:warn)
|
88
|
-
Elasticsearch::Model.inheritance_enabled = true
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
context 'when \'inheritance_enabled\' is false' do
|
93
|
-
|
94
|
-
it 'does not warn' do
|
95
|
-
expect(Elasticsearch::Model).not_to receive(:warn)
|
96
|
-
Elasticsearch::Model.inheritance_enabled = false
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
93
|
end
|
101
94
|
end
|
@@ -1,3 +1,20 @@
|
|
1
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
2
|
+
# license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright
|
4
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
+
# not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
|
1
18
|
require 'spec_helper'
|
2
19
|
|
3
20
|
describe Elasticsearch::Model::Multimodel do
|
@@ -1,3 +1,20 @@
|
|
1
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
2
|
+
# license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright
|
4
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
+
# not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
|
1
18
|
require 'spec_helper'
|
2
19
|
|
3
20
|
describe 'naming' do
|
@@ -34,9 +51,9 @@ describe 'naming' do
|
|
34
51
|
expect(::MyNamespace::DummyNamingModelInNamespace.new.index_name).to eq('my_namespace-dummy_naming_model_in_namespaces')
|
35
52
|
end
|
36
53
|
|
37
|
-
it 'returns
|
38
|
-
expect(DummyNamingModel.document_type).to
|
39
|
-
expect(DummyNamingModel.new.document_type).to
|
54
|
+
it 'returns nil' do
|
55
|
+
expect(DummyNamingModel.document_type).to be_nil
|
56
|
+
expect(DummyNamingModel.new.document_type).to be_nil
|
40
57
|
end
|
41
58
|
|
42
59
|
describe '#index_name' do
|
@@ -124,8 +141,8 @@ describe 'naming' do
|
|
124
141
|
|
125
142
|
describe '#document_type' do
|
126
143
|
|
127
|
-
it 'returns
|
128
|
-
expect(DummyNamingModel.document_type).to
|
144
|
+
it 'returns nil' do
|
145
|
+
expect(DummyNamingModel.document_type).to be_nil
|
129
146
|
end
|
130
147
|
|
131
148
|
context 'when the method is called with an argument' do
|
@@ -1,3 +1,20 @@
|
|
1
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
2
|
+
# license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright
|
4
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
+
# not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
|
1
18
|
require 'spec_helper'
|
2
19
|
|
3
20
|
describe Elasticsearch::Model::Proxy do
|
@@ -1,3 +1,20 @@
|
|
1
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
2
|
+
# license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright
|
4
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
+
# not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
|
1
18
|
require 'spec_helper'
|
2
19
|
|
3
20
|
describe Elasticsearch::Model::Response::Aggregations do
|
@@ -1,3 +1,20 @@
|
|
1
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
2
|
+
# license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright
|
4
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
+
# not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
|
1
18
|
require 'spec_helper'
|
2
19
|
|
3
20
|
describe Elasticsearch::Model::Response::Base do
|