我在 Heroku 上有一个 Rails API,并在重新索引类时遇到以下问题。
$ heroku run rake searchkick:reindex CLASS=User
并得到以下错误
Elasticsearch::Transport::Transport::Errors::BadRequest: [400] {"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"Root mapping definition has unsupported parameters: [_default_ : {_routing={}, dynamic_templates=[{string_template={mapping={ignore_above=30000, type=keyword, fields={analyzed={analyzer=searchkick_index, index=true, type=text}}}, match_mapping_type=string, match=*}}], properties={}}]"}],"type":"mapper_parsing_exception","reason":"Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [_default_ : {_routing={}, dynamic_templates=[{string_template={mapping={ignore_above=30000, type=keyword, fields={analyzed={analyzer=searchkick_index, index=true, type=text}}}, match_mapping_type=string, match=*}}], properties={}}]","caused_by":{"type":"mapper_parsing_exception","reason":"Root mapping definition has unsupported parameters: [_default_ : {_routing={}, dynamic_templates=[{string_template={mapping={ignore_above=30000, type=keyword, fields={analyzed={analyzer=searchkick_index, index=true, type=text}}}, match_mapping_type=string, match=*}}], properties={}}]"}},"status":400}
我的用户类具有以下内容
class User < ApplicationRecord
searchkick settings: {
number_of_shards: 1,
number_of_replicas: 1,
max_ngram_diff: 49,
max_shingle_diff: 4
}
end
我正在添加 max_ngram_diff 和 max_shingle_diff ,因为这解决了一个不同的问题。但是,我也不确定 max_ngram_diff 和 max_shingle_diff 的值是否正确。
从我的 Gemfile.lock
searchkick (2.5.0)
activemodel (>= 4.1)
elasticsearch (>= 1)
hashie
elasticsearch (6.2.0)
elasticsearch-api (= 6.2.0)
elasticsearch-transport (= 6.2.0)
elasticsearch-api (6.2.0)
multi_json
elasticsearch-transport (6.2.0)
faraday
multi_json
知道该怎么做吗?