gpt4 book ai didi

ruby-on-rails - Searchkick/Elasticsearch-根映射定义具有不受支持的参数

转载 作者:行者123 更新时间:2023-12-03 02:36:06 25 4
gpt4 key购买 nike

我在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


知道该怎么办吗?

最佳答案

此错误是由于与ElasticSearch的版本不兼容所致。即最新版本的Searchkick(即v4.1),需要ElasticSearch v7.4.0

我遇到此错误,并通过将我的Elasticsearch从7.x降级到6.8.4来解决。是runninng SearchKick(3.1.2)。

要在您的机器上检查ElasticSearch的版本,请运行以下命令:

curl -XGET 'localhost:9200'

通过 Gemfile检查计算机上运行的searchkick版本。从您的gemfile中,您需要ElasticSearch v6.2.0
要安装特定版本的ElasticSearch,请运行以下命令
brew install elasticsearch@6.2.0

重新启动您的elasticsearch服务!

关于ruby-on-rails - Searchkick/Elasticsearch-根映射定义具有不受支持的参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58859712/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com