Commit edbb1c9b213cef7776e88792cd8020a52022107f
1 parent
5d8cdd0d
Exists in
master
and in
17 other branches
Better code [skip ci]
Showing
1 changed file
with
4 additions
and
4 deletions
Show diff stats
lib/searchkick/index_options.rb
... | ... | @@ -13,10 +13,10 @@ module Searchkick |
13 | 13 | index_type = index_type.call if index_type.respond_to?(:call) |
14 | 14 | end |
15 | 15 | |
16 | - custom_mapping = (options[:mapping] || {}).symbolize_keys | |
17 | - if below70 && custom_mapping.any? && custom_mapping.key?(:properties) | |
16 | + custom_mapping = options[:mapping] || {} | |
17 | + if below70 && custom_mapping.keys.map(&:to_sym).include?(:properties) | |
18 | 18 | # add type |
19 | - custom_mapping = {index_type.to_sym => custom_mapping} | |
19 | + custom_mapping = {index_type => custom_mapping} | |
20 | 20 | end |
21 | 21 | |
22 | 22 | if options[:mappings] && !options[:merge_mappings] |
... | ... | @@ -426,7 +426,7 @@ module Searchkick |
426 | 426 | mappings = {index_type => mappings} |
427 | 427 | end |
428 | 428 | |
429 | - mappings = mappings.symbolize_keys.deep_merge(custom_mapping) | |
429 | + mappings = mappings.symbolize_keys.deep_merge(custom_mapping.symbolize_keys) | |
430 | 430 | end |
431 | 431 | |
432 | 432 | { | ... | ... |