【问题标题】:ElasticSearch: Error while upgrading Chewy/ElasticSearch versionElasticSearch:升级 Chewy/ElasticSearch 版本时出错
【发布时间】:2021-01-31 14:03:52
【问题描述】:

我一直在我的 rails 应用程序中使用 gem chewy,在 ElasticSearch 中创建索引和搜索。之前我用的是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 中运行良好。我试图在耐嚼中找到任何更改日志,但找不到任何更改日志。请帮助我了解问题出在哪里。 谢谢

【问题讨论】:

    标签: elasticsearch ruby-on-rails-5 elasticsearch-mapping chewy-gem


    【解决方案1】:

    正如 Elastic Search Ninja 所建议的,这是由于最新版本的 elasticsearch 中的removal of types 而发生的。

    截至今天(2020 年 10 月 19 日),Chewy 不支持 7.x 或 6.x

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

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

    【讨论】:

      【解决方案2】:

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

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

      【讨论】:

      • 但是貌似chewy不支持6.x或者7.x :(
      • @LunaLovegood 这很糟糕,因为 ES 6.x 也到了生命的尽头,也许你应该打开一个功能请求来支持最新版本的 ES ,如果我的回答有帮助请不要忘记赞成并接受它,在此先感谢:)
      • 是的,人们已经提出了功能请求,但所有者没有合并,因为它向后不兼容。当然,投票给你的答案。但是,如果有任何替代方案,要在 Rails 应用程序中处理索引,请告诉我,谢谢
      • @LunaLovegood 感谢您的支持,很抱歉我没有使用 ruby​​ 语法 :( 由于 Elasticsearch 是基于 REST(JSON) 的系统,我通常会尝试帮助使用 JSON 语法,希望您已经阅读了我在回答中提到的文章,因为您可以先在 JSON 中摆脱索引映射问题(REST api 格式,然后可以使用 ruby​​ 语法。
      猜你喜欢
      • 1970-01-01
      • 2019-12-01
      • 2022-01-05
      • 2020-12-30
      • 1970-01-01
      • 1970-01-01
      • 2017-05-20
      • 1970-01-01
      • 2022-01-17
      相关资源
      最近更新 更多