chewy 7.0.0 → 7.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +0 -26
- data/CHANGELOG.md +11 -0
- data/README.md +27 -38
- data/lib/chewy/fields/root.rb +1 -2
- data/lib/chewy/index.rb +4 -15
- data/lib/chewy/index/actions.rb +1 -3
- data/lib/chewy/index/aliases.rb +1 -3
- data/lib/chewy/railtie.rb +2 -18
- data/lib/chewy/search/loader.rb +2 -12
- data/lib/chewy/search/parameters/indices.rb +12 -57
- data/lib/chewy/search/request.rb +20 -40
- data/lib/chewy/search/response.rb +1 -1
- data/lib/chewy/search/scrolling.rb +1 -1
- data/lib/chewy/stash.rb +2 -5
- data/lib/chewy/type/import/bulk_request.rb +1 -2
- data/lib/chewy/type/import/journal_builder.rb +1 -2
- data/lib/chewy/type/import/routine.rb +2 -2
- data/lib/chewy/type/mapping.rb +1 -1
- data/lib/chewy/type/syncer.rb +1 -4
- data/lib/chewy/version.rb +1 -1
- data/lib/tasks/chewy.rake +10 -10
- data/migration_guide.md +6 -3
- data/spec/chewy/fields/base_spec.rb +4 -4
- data/spec/chewy/fields/root_spec.rb +4 -4
- data/spec/chewy/index/specification_spec.rb +13 -13
- data/spec/chewy/index_spec.rb +1 -3
- data/spec/chewy/journal_spec.rb +4 -4
- data/spec/chewy/runtime_spec.rb +1 -1
- data/spec/chewy/search/loader_spec.rb +0 -16
- data/spec/chewy/search/parameters/indices_spec.rb +25 -110
- data/spec/chewy/search/request_spec.rb +11 -28
- data/spec/chewy/search/scrolling_spec.rb +2 -8
- data/spec/chewy/search_spec.rb +2 -2
- data/spec/chewy/type/import/bulk_request_spec.rb +0 -6
- data/spec/chewy/type/import/journal_builder_spec.rb +0 -4
- data/spec/chewy/type/import_spec.rb +2 -2
- data/spec/chewy/type/mapping_spec.rb +5 -37
- metadata +2 -5
- data/lib/chewy/search/parameters/types.rb +0 -20
- data/spec/chewy/search/parameters/types_spec.rb +0 -5
data/lib/chewy/search/request.rb
CHANGED
@@ -41,7 +41,7 @@ module Chewy
|
|
41
41
|
EXTRA_STORAGES = %i[aggs suggest].freeze
|
42
42
|
# An array of storage names that are changing the returned hist collection in any way.
|
43
43
|
WHERE_STORAGES = %i[
|
44
|
-
query filter post_filter none
|
44
|
+
query filter post_filter none min_score rescore indices_boost
|
45
45
|
].freeze
|
46
46
|
|
47
47
|
delegate :hits, :wrappers, :objects, :records, :documents,
|
@@ -60,11 +60,11 @@ module Chewy
|
|
60
60
|
# Chewy::Search::Request.new(:places)
|
61
61
|
# # => <Chewy::Search::Request {:index=>["places"]}>
|
62
62
|
# Chewy::Search::Request.new(PlacesIndex)
|
63
|
-
# # => <Chewy::Search::Request {:index=>["places"]
|
63
|
+
# # => <Chewy::Search::Request {:index=>["places"]}>
|
64
64
|
# Chewy::Search::Request.new(PlacesIndex::City)
|
65
|
-
# # => <Chewy::Search::Request {:index=>["places"]
|
65
|
+
# # => <Chewy::Search::Request {:index=>["places"]}>
|
66
66
|
# Chewy::Search::Request.new(UsersIndex, PlacesIndex::City)
|
67
|
-
# # => <Chewy::Search::Request {:index=>["users", "places"]
|
67
|
+
# # => <Chewy::Search::Request {:index=>["users", "places"]}>
|
68
68
|
# @param indexes_or_types [Array<Chewy::Index, Chewy::Type, String, Symbol>] indices and types in any combinations
|
69
69
|
def initialize(*indices_or_types)
|
70
70
|
indices = indices_or_types.reject do |klass|
|
@@ -75,8 +75,10 @@ module Chewy
|
|
75
75
|
klass.is_a?(Class) && klass < Chewy::Type
|
76
76
|
end
|
77
77
|
|
78
|
+
indices += types.map(&:index)
|
79
|
+
|
78
80
|
parameters.modify!(:indices) do
|
79
|
-
replace!(indices: indices
|
81
|
+
replace!(indices: indices)
|
80
82
|
end
|
81
83
|
end
|
82
84
|
|
@@ -305,34 +307,18 @@ module Chewy
|
|
305
307
|
end
|
306
308
|
end
|
307
309
|
|
308
|
-
#
|
309
|
-
#
|
310
|
-
# Added passed indexes to the parameter list.
|
311
|
-
#
|
312
|
-
# @example
|
313
|
-
# UsersIndex.indices(CitiesIndex).indices(:another)
|
314
|
-
# # => <UsersIndex::Query {:index=>["another", "cities", "users"], :type=>["city", "user"]}>
|
315
|
-
# @see Chewy::Search::Parameters::Indices
|
316
|
-
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html
|
317
|
-
# @param values [Array<Chewy::Index, String, Symbol>] index names
|
318
|
-
# @return [Chewy::Search::Request]
|
310
|
+
# Modifies `index` request parameter. Updates the storage on every call.
|
311
|
+
# Added passed indexes to the parameter list.
|
319
312
|
#
|
320
|
-
#
|
321
|
-
#
|
322
|
-
#
|
323
|
-
#
|
324
|
-
#
|
325
|
-
#
|
326
|
-
#
|
327
|
-
|
328
|
-
|
329
|
-
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html
|
330
|
-
# @param values [Array<Chewy::Type, String, Symbol>] type names
|
331
|
-
# @return [Chewy::Search::Request]
|
332
|
-
%i[indices types].each do |name|
|
333
|
-
define_method name do |value, *values|
|
334
|
-
modify(:indices) { update!(name => [value, *values]) }
|
335
|
-
end
|
313
|
+
# @example
|
314
|
+
# UsersIndex.indices(CitiesIndex).indices(:another)
|
315
|
+
# # => <UsersIndex::Query {:index=>["another", "cities", "users"]}>
|
316
|
+
# @see Chewy::Search::Parameters::Indices
|
317
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html
|
318
|
+
# @param values [Array<Chewy::Index, String, Symbol>] index names
|
319
|
+
# @return [Chewy::Search::Request]
|
320
|
+
def indices(value, *values)
|
321
|
+
modify(:indices) { update!(indices: [value, *values]) }
|
336
322
|
end
|
337
323
|
|
338
324
|
# @overload reorder(*values)
|
@@ -990,7 +976,6 @@ module Chewy
|
|
990
976
|
|
991
977
|
def perform(additional = {})
|
992
978
|
request_body = render.merge(additional)
|
993
|
-
request_body[:rest_total_hits_as_int] = true if Runtime.version >= '7.0.0'
|
994
979
|
ActiveSupport::Notifications.instrument 'search_query.chewy',
|
995
980
|
notification_payload(request: request_body) do
|
996
981
|
begin
|
@@ -1003,9 +988,8 @@ module Chewy
|
|
1003
988
|
|
1004
989
|
def notification_payload(additional)
|
1005
990
|
{
|
1006
|
-
indexes: _indices,
|
1007
|
-
index: _indices.one? ? _indices.first : _indices
|
1008
|
-
type: _types.one? ? _types.first : _types
|
991
|
+
indexes: _indices,
|
992
|
+
index: _indices.one? ? _indices.first : _indices
|
1009
993
|
}.merge(additional)
|
1010
994
|
end
|
1011
995
|
|
@@ -1013,10 +997,6 @@ module Chewy
|
|
1013
997
|
parameters[:indices].indices
|
1014
998
|
end
|
1015
999
|
|
1016
|
-
def _types
|
1017
|
-
parameters[:indices].types
|
1018
|
-
end
|
1019
|
-
|
1020
1000
|
def raw_limit_value
|
1021
1001
|
parameters[:limit].value
|
1022
1002
|
end
|
@@ -28,7 +28,7 @@ module Chewy
|
|
28
28
|
return enum_for(:scroll_batches, batch_size: batch_size, scroll: scroll) unless block_given?
|
29
29
|
|
30
30
|
result = perform(size: batch_size, scroll: scroll)
|
31
|
-
total = [raw_limit_value, result.fetch('hits', {}).fetch('total', 0)].compact.min
|
31
|
+
total = [raw_limit_value, result.fetch('hits', {}).fetch('total', {}).fetch('value', 0)].compact.min
|
32
32
|
last_batch_size = total % batch_size
|
33
33
|
fetched = 0
|
34
34
|
scroll_id = nil
|
data/lib/chewy/stash.rb
CHANGED
@@ -46,11 +46,8 @@ module Chewy
|
|
46
46
|
types = something.flat_map { |s| Chewy.derive_types(s) }
|
47
47
|
return none if something.present? && types.blank?
|
48
48
|
scope = all
|
49
|
-
types.
|
50
|
-
scope = scope.or(
|
51
|
-
filter(term: {index_name: index.derivable_name})
|
52
|
-
.filter(terms: {type_name: index_types.map(&:type_name)})
|
53
|
-
)
|
49
|
+
types.map(&:index).uniq.each do |index|
|
50
|
+
scope = scope.or(filter(term: {index_name: index.derivable_name}))
|
54
51
|
end
|
55
52
|
scope
|
56
53
|
end
|
@@ -69,8 +69,8 @@ module Chewy
|
|
69
69
|
@type.index.create!(**@bulk_options.slice(:suffix)) unless @type.index.exists?
|
70
70
|
end
|
71
71
|
|
72
|
-
# The main process method. Converts passed objects to
|
73
|
-
# appends journal
|
72
|
+
# The main process method. Converts passed objects to the bulk request body,
|
73
|
+
# appends journal entries, performs this request and handles errors performing
|
74
74
|
# failover procedures if applicable.
|
75
75
|
#
|
76
76
|
# @param index [Array<Object>] any acceptable objects for indexing
|
data/lib/chewy/type/mapping.rb
CHANGED
@@ -183,7 +183,7 @@ module Chewy
|
|
183
183
|
# Returns compiled mappings hash for current type
|
184
184
|
#
|
185
185
|
def mappings_hash
|
186
|
-
root.mappings_hash
|
186
|
+
root.mappings_hash
|
187
187
|
end
|
188
188
|
|
189
189
|
# Check whether the type has outdated_sync_field defined with a simple value.
|
data/lib/chewy/type/syncer.rb
CHANGED
@@ -205,12 +205,9 @@ module Chewy
|
|
205
205
|
return @outdated_sync_field_type if instance_variable_defined?(:@outdated_sync_field_type)
|
206
206
|
return unless @type.outdated_sync_field
|
207
207
|
|
208
|
-
|
209
|
-
args[:include_type_name] = true if Runtime.version >= '6.7.0'
|
210
|
-
mappings = @type.client.indices.get_mapping(**args).values.first.fetch('mappings', {})
|
208
|
+
mappings = @type.client.indices.get_mapping(index: @type.index_name).values.first.fetch('mappings', {})
|
211
209
|
|
212
210
|
@outdated_sync_field_type = mappings
|
213
|
-
.fetch(@type.type_name, {})
|
214
211
|
.fetch('properties', {})
|
215
212
|
.fetch(@type.outdated_sync_field.to_s, {})['type']
|
216
213
|
rescue Elasticsearch::Transport::Transport::Errors::NotFound
|
data/lib/chewy/version.rb
CHANGED
data/lib/tasks/chewy.rake
CHANGED
@@ -23,22 +23,22 @@ end
|
|
23
23
|
namespace :chewy do
|
24
24
|
desc 'Destroys, recreates and imports data for the specified indexes or all of them'
|
25
25
|
task reset: :environment do |_task, args|
|
26
|
-
Chewy::RakeHelper.reset(parse_classes(args.extras))
|
26
|
+
Chewy::RakeHelper.reset(**parse_classes(args.extras))
|
27
27
|
end
|
28
28
|
|
29
29
|
desc 'Resets data for the specified indexes or all of them only if the index specification is changed'
|
30
30
|
task upgrade: :environment do |_task, args|
|
31
|
-
Chewy::RakeHelper.upgrade(parse_classes(args.extras))
|
31
|
+
Chewy::RakeHelper.upgrade(**parse_classes(args.extras))
|
32
32
|
end
|
33
33
|
|
34
34
|
desc 'Updates data for the specified indexes/types or all of them'
|
35
35
|
task update: :environment do |_task, args|
|
36
|
-
Chewy::RakeHelper.update(parse_classes(args.extras))
|
36
|
+
Chewy::RakeHelper.update(**parse_classes(args.extras))
|
37
37
|
end
|
38
38
|
|
39
39
|
desc 'Synchronizes data for the specified indexes/types or all of them'
|
40
40
|
task sync: :environment do |_task, args|
|
41
|
-
Chewy::RakeHelper.sync(parse_classes(args.extras))
|
41
|
+
Chewy::RakeHelper.sync(**parse_classes(args.extras))
|
42
42
|
end
|
43
43
|
|
44
44
|
desc 'Resets all the indexes with the specification changed and synchronizes the rest of them'
|
@@ -50,22 +50,22 @@ namespace :chewy do
|
|
50
50
|
namespace :parallel do
|
51
51
|
desc 'Parallel version of `rake chewy:reset`'
|
52
52
|
task reset: :environment do |_task, args|
|
53
|
-
Chewy::RakeHelper.reset(parse_parallel_args(args.extras))
|
53
|
+
Chewy::RakeHelper.reset(**parse_parallel_args(args.extras))
|
54
54
|
end
|
55
55
|
|
56
56
|
desc 'Parallel version of `rake chewy:upgrade`'
|
57
57
|
task upgrade: :environment do |_task, args|
|
58
|
-
Chewy::RakeHelper.upgrade(parse_parallel_args(args.extras))
|
58
|
+
Chewy::RakeHelper.upgrade(**parse_parallel_args(args.extras))
|
59
59
|
end
|
60
60
|
|
61
61
|
desc 'Parallel version of `rake chewy:update`'
|
62
62
|
task update: :environment do |_task, args|
|
63
|
-
Chewy::RakeHelper.update(parse_parallel_args(args.extras))
|
63
|
+
Chewy::RakeHelper.update(**parse_parallel_args(args.extras))
|
64
64
|
end
|
65
65
|
|
66
66
|
desc 'Parallel version of `rake chewy:sync`'
|
67
67
|
task sync: :environment do |_task, args|
|
68
|
-
Chewy::RakeHelper.sync(parse_parallel_args(args.extras))
|
68
|
+
Chewy::RakeHelper.sync(**parse_parallel_args(args.extras))
|
69
69
|
end
|
70
70
|
|
71
71
|
desc 'Parallel version of `rake chewy:deploy`'
|
@@ -79,12 +79,12 @@ namespace :chewy do
|
|
79
79
|
namespace :journal do
|
80
80
|
desc 'Applies changes that were done after the specified time for the specified indexes/types or all of them'
|
81
81
|
task apply: :environment do |_task, args|
|
82
|
-
Chewy::RakeHelper.journal_apply(parse_journal_args(args.extras))
|
82
|
+
Chewy::RakeHelper.journal_apply(**parse_journal_args(args.extras))
|
83
83
|
end
|
84
84
|
|
85
85
|
desc 'Removes journal records created before the specified timestamp for the specified indexes/types or all of them'
|
86
86
|
task clean: :environment do |_task, args|
|
87
|
-
Chewy::RakeHelper.journal_clean(parse_journal_args(args.extras))
|
87
|
+
Chewy::RakeHelper.journal_clean(**parse_journal_args(args.extras))
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
data/migration_guide.md
CHANGED
@@ -10,10 +10,13 @@ In order to upgrade Chewy 6/Elasticsearch 6 to Chewy 7/Elasticsearch 7 in the mo
|
|
10
10
|
|
11
11
|
* Upgrade to the latest 6.x stable releases, namely Chewy 6.0, Elasticsearch 6.8
|
12
12
|
* Study carefully [Breaking changes in 7.0](https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking-changes-7.0.htmll), make sure your application conforms.
|
13
|
-
* Run your test suite on Chewy 7 / Elasticsearch 7
|
14
|
-
* Run manual tests on Chewy 7 / Elasticsearch 7
|
15
|
-
* Upgrade to Chewy 7
|
13
|
+
* Run your test suite on Chewy 7.0 / Elasticsearch 7
|
14
|
+
* Run manual tests on Chewy 7.0 / Elasticsearch 7
|
15
|
+
* Upgrade to Chewy 7.0
|
16
16
|
* Perform a [rolling upgrade](https://www.elastic.co/guide/en/elasticsearch/reference//rolling-upgrades.html) of Elasticsearch
|
17
|
+
* Run your test suite on Chewy 7.1 / Elasticsearch 7
|
18
|
+
* Run manual tests on Chewy 7.1 / Elasticsearch 7
|
19
|
+
* Upgrade to Chewy 7.1
|
17
20
|
|
18
21
|
## Chewy 5/Elasticsearch 5 to Chewy 6/Elasticsearch 6
|
19
22
|
|
@@ -143,7 +143,7 @@ describe Chewy::Fields::Base do
|
|
143
143
|
end
|
144
144
|
|
145
145
|
specify do
|
146
|
-
expect(EventsIndex::Event.mappings_hash).to eq(
|
146
|
+
expect(EventsIndex::Event.mappings_hash).to eq(
|
147
147
|
properties: {
|
148
148
|
id: {type: 'integer'},
|
149
149
|
category: {
|
@@ -160,7 +160,7 @@ describe Chewy::Fields::Base do
|
|
160
160
|
}
|
161
161
|
}
|
162
162
|
}
|
163
|
-
|
163
|
+
)
|
164
164
|
end
|
165
165
|
end
|
166
166
|
|
@@ -296,7 +296,7 @@ describe Chewy::Fields::Base do
|
|
296
296
|
end
|
297
297
|
|
298
298
|
specify do
|
299
|
-
expect(EventsIndex::Event.mappings_hash).to eq(
|
299
|
+
expect(EventsIndex::Event.mappings_hash).to eq(
|
300
300
|
properties: {
|
301
301
|
id: {type: 'integer'},
|
302
302
|
name: {
|
@@ -307,7 +307,7 @@ describe Chewy::Fields::Base do
|
|
307
307
|
},
|
308
308
|
category: {type: 'object'}
|
309
309
|
}
|
310
|
-
|
310
|
+
)
|
311
311
|
end
|
312
312
|
|
313
313
|
specify do
|
@@ -13,7 +13,7 @@ describe Chewy::Fields::Root do
|
|
13
13
|
field.dynamic_template template_42: {mapping: {}, match: ''}
|
14
14
|
field.dynamic_template(/hello\..*/)
|
15
15
|
|
16
|
-
expect(field.mappings_hash).to eq(
|
16
|
+
expect(field.mappings_hash).to eq(dynamic_templates: [
|
17
17
|
{template_1: {mapping: {type: 'keyword'}, match: 'hello'}},
|
18
18
|
{template_2: {mapping: {}, match_mapping_type: 'integer', match: 'hello*'}},
|
19
19
|
{template_3: {mapping: {}, path_match: 'hello.*'}},
|
@@ -21,7 +21,7 @@ describe Chewy::Fields::Root do
|
|
21
21
|
{template_5: {mapping: {}, match: 'hello.*', match_pattern: 'regexp'}},
|
22
22
|
{template_42: {mapping: {}, match: ''}},
|
23
23
|
{template_7: {mapping: {}, path_match: 'hello\..*', match_pattern: 'regexp'}}
|
24
|
-
]
|
24
|
+
])
|
25
25
|
end
|
26
26
|
|
27
27
|
context do
|
@@ -33,10 +33,10 @@ describe Chewy::Fields::Root do
|
|
33
33
|
|
34
34
|
specify do
|
35
35
|
field.dynamic_template 'hello', type: 'keyword'
|
36
|
-
expect(field.mappings_hash).to eq(
|
36
|
+
expect(field.mappings_hash).to eq(dynamic_templates: [
|
37
37
|
{template_42: {mapping: {}, match: ''}},
|
38
38
|
{template_1: {mapping: {type: 'keyword'}, match: 'hello'}}
|
39
|
-
]
|
39
|
+
])
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
@@ -56,12 +56,12 @@ describe Chewy::Index::Specification do
|
|
56
56
|
specify do
|
57
57
|
expect { specification1.lock! }.to change { Chewy::Stash::Specification.all.hits }.from([]).to([{
|
58
58
|
'_index' => 'chewy_specifications',
|
59
|
-
'_type' => '
|
59
|
+
'_type' => '_doc',
|
60
60
|
'_id' => 'places',
|
61
61
|
'_score' => 1.0,
|
62
62
|
'_source' => {'specification' => Base64.encode64({
|
63
63
|
'settings' => {'index' => {'number_of_shards' => 1, 'number_of_replicas' => 0}},
|
64
|
-
'mappings' => {'
|
64
|
+
'mappings' => {'properties' => {'founded_on' => {'type' => 'date'}}}
|
65
65
|
}.to_json)}
|
66
66
|
}])
|
67
67
|
end
|
@@ -72,21 +72,21 @@ describe Chewy::Index::Specification do
|
|
72
72
|
specify do
|
73
73
|
expect { specification5.lock! }.to change { Chewy::Stash::Specification.all.hits }.to([{
|
74
74
|
'_index' => 'chewy_specifications',
|
75
|
-
'_type' => '
|
75
|
+
'_type' => '_doc',
|
76
76
|
'_id' => 'places',
|
77
77
|
'_score' => 1.0,
|
78
78
|
'_source' => {'specification' => Base64.encode64({
|
79
79
|
'settings' => {'index' => {'number_of_shards' => 1, 'number_of_replicas' => 0}},
|
80
|
-
'mappings' => {'
|
80
|
+
'mappings' => {'properties' => {'founded_on' => {'type' => 'date'}}}
|
81
81
|
}.to_json)}
|
82
82
|
}, {
|
83
83
|
'_index' => 'chewy_specifications',
|
84
|
-
'_type' => '
|
84
|
+
'_type' => '_doc',
|
85
85
|
'_id' => 'namespace/cities',
|
86
86
|
'_score' => 1.0,
|
87
87
|
'_source' => {'specification' => Base64.encode64({
|
88
88
|
'settings' => {'index' => {'number_of_shards' => 1, 'number_of_replicas' => 0}},
|
89
|
-
'mappings' => {'
|
89
|
+
'mappings' => {'properties' => {'population' => {'type' => 'integer'}}}
|
90
90
|
}.to_json)}
|
91
91
|
}])
|
92
92
|
end
|
@@ -97,14 +97,14 @@ describe Chewy::Index::Specification do
|
|
97
97
|
specify do
|
98
98
|
expect { specification1.lock! }.to change { specification1.locked }.from({}).to(
|
99
99
|
'settings' => {'index' => {'number_of_shards' => 1, 'number_of_replicas' => 0}},
|
100
|
-
'mappings' => {'
|
100
|
+
'mappings' => {'properties' => {'founded_on' => {'type' => 'date'}}}
|
101
101
|
)
|
102
102
|
end
|
103
103
|
|
104
104
|
specify do
|
105
105
|
expect { specification5.lock! }.to change { specification5.locked }.from({}).to(
|
106
106
|
'settings' => {'index' => {'number_of_shards' => 1, 'number_of_replicas' => 0}},
|
107
|
-
'mappings' => {'
|
107
|
+
'mappings' => {'properties' => {'population' => {'type' => 'integer'}}}
|
108
108
|
)
|
109
109
|
end
|
110
110
|
|
@@ -114,20 +114,20 @@ describe Chewy::Index::Specification do
|
|
114
114
|
specify do
|
115
115
|
expect { specification2.lock! }.to change { specification2.locked }.from(
|
116
116
|
'settings' => {'index' => {'number_of_shards' => 1, 'number_of_replicas' => 0}},
|
117
|
-
'mappings' => {'
|
117
|
+
'mappings' => {'properties' => {'founded_on' => {'type' => 'date'}}}
|
118
118
|
).to(
|
119
119
|
'settings' => {'analyzer' => {}, 'index' => {'number_of_shards' => 1, 'number_of_replicas' => 0}},
|
120
|
-
'mappings' => {'
|
120
|
+
'mappings' => {'properties' => {'founded_on' => {'type' => 'date'}}}
|
121
121
|
)
|
122
122
|
end
|
123
123
|
|
124
124
|
specify do
|
125
125
|
expect { specification3.lock! }.to change { specification3.locked }.from(
|
126
126
|
'settings' => {'index' => {'number_of_shards' => 1, 'number_of_replicas' => 0}},
|
127
|
-
'mappings' => {'
|
127
|
+
'mappings' => {'properties' => {'founded_on' => {'type' => 'date'}}}
|
128
128
|
).to(
|
129
129
|
'settings' => {'index' => {'number_of_shards' => 1, 'number_of_replicas' => 0}},
|
130
|
-
'mappings' => {'
|
130
|
+
'mappings' => {'properties' => {'founded_on' => {'type' => 'date'}, 'population' => {'type' => 'integer'}}}
|
131
131
|
)
|
132
132
|
end
|
133
133
|
end
|
@@ -136,7 +136,7 @@ describe Chewy::Index::Specification do
|
|
136
136
|
describe '#current' do
|
137
137
|
specify do
|
138
138
|
expect(specification2.current).to eq(
|
139
|
-
'mappings' => {'
|
139
|
+
'mappings' => {'properties' => {'founded_on' => {'type' => 'date'}}},
|
140
140
|
'settings' => {'analyzer' => {}, 'index' => {'number_of_shards' => 1, 'number_of_replicas' => 0}}
|
141
141
|
)
|
142
142
|
end
|