Hi,
Below is my setup
searchkick 4.0.0
rails 5.1.7
ruby 2.6.2
ElasticSearch 7.0.1
MacOS 10.14.4
I am trying to define a custom mapping for a field since I need it to be indexed as a float
searchkick word_middle: %i[name product_id category_ids updated_at retail_price retail_price_for_sorting origin_id company_group_id product_group_ids],
mappings: {
product: {
properties: {
retail_price_for_sorting: { type: "float"},
}
}
},
merge_mappings: true
and once I try to reindex I get the following error
Elasticsearch::Transport::Transport::Errors::BadRequest ([400] {"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"Root mapping definition has unsupported parameters: [product : {properties={retail_price_for_sorting={type=float}}}]"}],"type":"mapper_parsing_exception","reason":"Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [product : {properties={retail_price_for_sorting={type=float}}}]","caused_by":{"type":"mapper_parsing_exception","reason":"Root mapping definition has unsupported parameters: [product : {properties={retail_price_for_sorting={type=float}}}]"}},"status":400})
any thoughts on this?
Thanks in advance :)
This issue does not occur with ElasticSearch 6.2.2. But present in ElasticSearch 7.0.1
Hey @namila, Elasticsearch 7 does not support mapping types. You'll need to remove the root product key.
ES 6
class Product < ApplicationRecord
searchkick mappings: {
product: {
properties: {
name: {type: "keyword"}
}
}
}
end
ES 7
class Product < ApplicationRecord
searchkick mappings: {
properties: {
name: {type: "keyword"}
}
}
end
Thanks a lot @ankane :) by the way this is an awesome Gem <3
Made root type mapping optional on master with Elasticsearch 6, so the Elasticsearch 7 example above can be used for both versions going forward.
Most helpful comment
Hey @namila, Elasticsearch 7 does not support mapping types. You'll need to remove the root
productkey.ES 6
ES 7