chewy 7.0.1 → 7.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +0 -26
  3. data/CHANGELOG.md +7 -3
  4. data/README.md +27 -38
  5. data/lib/chewy/fields/root.rb +1 -2
  6. data/lib/chewy/index.rb +4 -15
  7. data/lib/chewy/index/actions.rb +1 -3
  8. data/lib/chewy/index/aliases.rb +1 -3
  9. data/lib/chewy/railtie.rb +2 -18
  10. data/lib/chewy/search/loader.rb +2 -12
  11. data/lib/chewy/search/parameters/indices.rb +12 -57
  12. data/lib/chewy/search/request.rb +20 -40
  13. data/lib/chewy/search/response.rb +1 -1
  14. data/lib/chewy/search/scrolling.rb +1 -1
  15. data/lib/chewy/stash.rb +2 -5
  16. data/lib/chewy/type/import/bulk_request.rb +1 -2
  17. data/lib/chewy/type/import/journal_builder.rb +1 -2
  18. data/lib/chewy/type/import/routine.rb +2 -2
  19. data/lib/chewy/type/mapping.rb +1 -1
  20. data/lib/chewy/type/syncer.rb +1 -4
  21. data/lib/chewy/version.rb +1 -1
  22. data/lib/tasks/chewy.rake +10 -10
  23. data/migration_guide.md +0 -19
  24. data/spec/chewy/fields/base_spec.rb +4 -4
  25. data/spec/chewy/fields/root_spec.rb +4 -4
  26. data/spec/chewy/index/specification_spec.rb +13 -13
  27. data/spec/chewy/index_spec.rb +1 -3
  28. data/spec/chewy/journal_spec.rb +4 -4
  29. data/spec/chewy/runtime_spec.rb +1 -1
  30. data/spec/chewy/search/loader_spec.rb +0 -16
  31. data/spec/chewy/search/parameters/indices_spec.rb +25 -110
  32. data/spec/chewy/search/request_spec.rb +11 -28
  33. data/spec/chewy/search/scrolling_spec.rb +2 -8
  34. data/spec/chewy/search_spec.rb +2 -2
  35. data/spec/chewy/type/import/bulk_request_spec.rb +0 -6
  36. data/spec/chewy/type/import/journal_builder_spec.rb +0 -4
  37. data/spec/chewy/type/import_spec.rb +2 -2
  38. data/spec/chewy/type/mapping_spec.rb +5 -37
  39. metadata +2 -6
  40. data/.github/workflows/ruby.yml +0 -94
  41. data/lib/chewy/search/parameters/types.rb +0 -20
  42. data/spec/chewy/search/parameters/types_spec.rb +0 -5
@@ -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 types min_score rescore indices_boost
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"], :type=>["city", "country"]}>
63
+ # # => <Chewy::Search::Request {:index=>["places"]}>
64
64
  # Chewy::Search::Request.new(PlacesIndex::City)
65
- # # => <Chewy::Search::Request {:index=>["places"], :type=>["city"]}>
65
+ # # => <Chewy::Search::Request {:index=>["places"]}>
66
66
  # Chewy::Search::Request.new(UsersIndex, PlacesIndex::City)
67
- # # => <Chewy::Search::Request {:index=>["users", "places"], :type=>["city", "user"]}>
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, types: types)
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
- # @!method indices(*values)
309
- # Modifies `index` request parameter. Updates the storage on every call.
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
- # @!method types(*values)
321
- # Modifies `type` request parameter. Updates the storage on every call.
322
- # Constrains types passed on the request initialization or adds them
323
- # to the list depending on circumstances.
324
- #
325
- # @example
326
- # UsersIndex.types(CitiesIndex::City).types(:unexistent)
327
- # # => <UsersIndex::Query {:index=>["cities", "users"], :type=>["city", "user"]}>
328
- # @see Chewy::Search::Parameters::Indices
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 Chewy::Runtime::Version.new(Chewy.client.info['version']['number']) >= '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, types: _types,
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
@@ -23,7 +23,7 @@ module Chewy
23
23
  #
24
24
  # @return [Integer]
25
25
  def total
26
- @total ||= hits_root['total'] || 0
26
+ @total ||= hits_root.fetch('total', {}).fetch('value', 0)
27
27
  end
28
28
 
29
29
  # Response `max_score` field.
@@ -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.group_by(&:index).each do |index, index_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
@@ -47,8 +47,7 @@ module Chewy
47
47
 
48
48
  def request_base
49
49
  @request_base ||= {
50
- index: @type.index_name(suffix: @suffix),
51
- type: @type.type_name
50
+ index: @type.index_name(suffix: @suffix)
52
51
  }.merge!(@bulk_options)
53
52
  end
54
53
 
@@ -17,8 +17,7 @@ module Chewy
17
17
  ].compact
18
18
  ).bulk_body.each do |item|
19
19
  item.values.first.merge!(
20
- _index: Chewy::Stash::Journal.index_name,
21
- _type: Chewy::Stash::Journal::Journal.type_name
20
+ _index: Chewy::Stash::Journal.index_name
22
21
  )
23
22
  end
24
23
  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 thr bulk request body,
73
- # appends journal entires, performs this request and handles errors performing
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
@@ -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[type_name.to_sym].present? ? 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.
@@ -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
- args = {index: @type.index_name, type: @type.type_name}
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
@@ -1,3 +1,3 @@
1
1
  module Chewy
2
- VERSION = '7.0.1'.freeze
2
+ VERSION = '7.1.0'.freeze
3
3
  end
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
@@ -13,29 +13,10 @@ In order to upgrade Chewy 6/Elasticsearch 6 to Chewy 7/Elasticsearch 7 in the mo
13
13
  * Run your test suite on Chewy 7.0 / Elasticsearch 7
14
14
  * Run manual tests on Chewy 7.0 / Elasticsearch 7
15
15
  * Upgrade to Chewy 7.0
16
- * The “total hits” counter is an integer for ES versions < 7 and an object (hash) for the versions starting from 7.0.0. Elasticsearch added a special option, `rest_total_hits_as_int`, to ease the upgrade, that could be appended to any request and results in the old “total hits” format. Unfortunately, this option is not recognized by ES versions prior to 7.0.0, which means that we have to check the version to decide if we need this option.
17
- Normally Chewy does memoization of the current ES version, but this might be inappropriate for the upgrade, as the version changes live.
18
- To handle that we have 2 versions of Chewy for this stage of the upgrade: 7.0.0 and 7.0.1. Version 7.0.0 does the memoization and version 7.0.1 requests the current version on every search request.
19
- * You can use the 7.0.0 version if it's fine for you to have an application restart immediately after ES cluster upgrade.
20
- * If you're using the 7.0.1 version you might be interested in keeping the timeframe between this step and the last one as small as possible, as version 7.0.1 skips ES version memoization for search requests to help dynamically detect ES version. This leads to an extra version request on each search request, i.e. could affect the overall performance/latency of the search and a load of ES cluster.
21
16
  * Perform a [rolling upgrade](https://www.elastic.co/guide/en/elasticsearch/reference//rolling-upgrades.html) of Elasticsearch
22
17
  * Run your test suite on Chewy 7.1 / Elasticsearch 7
23
18
  * Run manual tests on Chewy 7.1 / Elasticsearch 7
24
19
  * Upgrade to Chewy 7.1
25
- * Upgrade to Chewy 7.2:
26
- * Remove all the the `Chewy::Type` class usages, e.g. remove `CitiesIndex::City` / `CitiesIndex.city`
27
- * `CitiesIndex::City.import! ...` becomes `CitiesIndex.import! ...`
28
- * Update indexes with simplified DSL:
29
- * `define_type` block -> `index_scope` clause
30
- * it can be omitted completely, if you don't need to specify the scope or options, e.g. `name`
31
- * Remove type names from string representations:
32
- * in `update_index` ActiveRecord helper and RSpec matcher, e.g.
33
- * `update_index('cities#city')` -> `update_index('cities')`
34
- * `update_index(UsersIndex::User)` -> `update_index(UsersIndex)`
35
- * in rake tasks (e.g. `rake chewy:update[cities#city]` -> `rake chewy:update[cities]`)
36
- * rake tasks output is also changed (e.g. `Imported CitiesIndex::City in 1s, stats: index 3` -> `Imported CitiesIndex in 1s, stats: index 3`)
37
- * Use index name instead of type name in loader additional scope
38
- * e.g. `CitiesIndex.filter(...).load(city: {scope: City.where(...)})` -> `CitiesIndex.filter(...).load(cities: {scope: City.where(...)})`
39
20
 
40
21
  ## Chewy 5/Elasticsearch 5 to Chewy 6/Elasticsearch 6
41
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(event: {
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(event: {
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(product: {dynamic_templates: [
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(product: {dynamic_templates: [
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' => 'specification',
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' => {'city' => {'properties' => {'founded_on' => {'type' => 'date'}}}}
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' => 'specification',
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' => {'city' => {'properties' => {'founded_on' => {'type' => 'date'}}}}
80
+ 'mappings' => {'properties' => {'founded_on' => {'type' => 'date'}}}
81
81
  }.to_json)}
82
82
  }, {
83
83
  '_index' => 'chewy_specifications',
84
- '_type' => 'specification',
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' => {'city' => {'properties' => {'population' => {'type' => 'integer'}}}}
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' => {'city' => {'properties' => {'founded_on' => {'type' => 'date'}}}}
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' => {'city' => {'properties' => {'population' => {'type' => 'integer'}}}}
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' => {'city' => {'properties' => {'founded_on' => {'type' => 'date'}}}}
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' => {'city' => {'properties' => {'founded_on' => {'type' => 'date'}}}}
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' => {'city' => {'properties' => {'founded_on' => {'type' => 'date'}}}}
127
+ 'mappings' => {'properties' => {'founded_on' => {'type' => 'date'}}}
128
128
  ).to(
129
129
  'settings' => {'index' => {'number_of_shards' => 1, 'number_of_replicas' => 0}},
130
- 'mappings' => {'city' => {'properties' => {'founded_on' => {'type' => 'date'}, 'population' => {'type' => 'integer'}}}}
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' => {'city' => {'properties' => {'founded_on' => {'type' => 'date'}}}},
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