ElasticSearch:升级 Chewy/ElasticSearch 版本时出错

ElasticSearch: Error while upgrading Chewy/ElasticSearch version

我一直在 rails 应用程序中使用 gem chewy 在 ElasticSearch 中创建索引和搜索。之前用的是elastic search 5.6版本,现在想升级到7.7。当我尝试创建索引时出现以下错误。我在 5.1.0

中使用的升级版咀嚼版
Elasticsearch::Transport::Transport::Errors::BadRequest: [400] {"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"Root mapping definition has unsupported parameters:  [country : {value={}}] [city : {value={}}] [state : {value={}}]"}],"type":"mapper_parsing_exception","reason":"Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters:  [country : {value={}}] [city : {value={}}] [state : {value={}}]","caused_by":{"type":"mapper_parsing_exception","reason":"Root mapping definition has unsupported parameters:  [country : {value={}}] [city : {value={}}] [state : {value={}}]"}},"status":400}

但是,它在 5.6 上运行得非常好。我试图在 chewy 中找到任何更改日志,但没有找到任何更改日志。请帮助我了解问题出在哪里。 谢谢

这是由于最新版本的 elasticsearch 中的 removal of types 造成的。您需要更改映射和索引定义才能解决该问题。

此外,请参阅 schedule of removal types according to versions 以及如果要从 5.X 迁移到 7.7 所需的所有步骤。

正如 Elastic Search Ninja 所建议的那样,这是由于最新版本的 elasticsearch 中的 removal of types 造成的。

截至今天 (19-Oct-2020) ,Chewy 不支持 7.x 或 6.x

参考: https://github.com/toptal/chewy/issues/609https://github.com/toptal/chewy/issues/673

ruby或rails推荐使用ES官方标准包。 https://github.com/elastic/elasticsearch-rubyhttps://github.com/elastic/elasticsearch-rails