问题描述
我一直在Rails应用程序中使用宝石chewy来创建索引并在ElasticSearch中进行搜索。以前,我使用的是弹性搜索版本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完美配合。我试图在耐嚼中找到任何更改日志,但都找不到。请帮助我了解问题所在。 谢谢
解决方法
正如Elastic Search Ninja所建议的,发生这种情况的原因是Elasticsearch最新版本中的removal of types。
截至今天的(2020年10月19日),Chewy不支持7.x或6.x
参考: https://github.com/toptal/chewy/issues/609和 https://github.com/toptal/chewy/issues/673
建议将ES的官方标准软件包用于红宝石或铁轨。 https://github.com/elastic/elasticsearch-ruby或 https://github.com/elastic/elasticsearch-rails
,发生这种情况的原因是最新版本的Elasticsearch中的removal of types。您需要更改映射和索引定义才能解决该问题。
此外,请参阅schedule of removal types according to versions以及要从5.X迁移到7.7所需的所有步骤。