在一个环境中使用Chewy gem的Rails 4应用程序上的ElasticSearch Fielddata错误

时间:2018-08-08 01:46:47

标签: ruby-on-rails ruby-on-rails-4 elasticsearch chewy-gem

我们有一个在stagingproduction两个相似的环境中运行的Rails 4应用程序。

最近,此错误开始出现在本地开发环境和登台环境上,但在生产环境中没有发生。

Elasticsearch::Transport::Transport::Errors::BadRequest: [400] {
  "error": {
    "root_cause":[{ "type": "illegal_argument_exception",
      "reason":"Fielddata is disabled on text fields by default. 
        Set fielddata=true on [updated_at] in order to load fielddata in memory 
        by uninverting the inverted index. Note that this can however use 
        significant memory. Alternatively use a keyword field instead."}],
      "type":"search_phase_execution_exception",
      "reason":"all shards failed",
      "phase":"query",
      "grouped":true,
      "failed_shards":[{"shard":0,
      "index":"users",
      "node":"xxxxxxxxxxxxxxxxxxxxxxxx",
      "reason":{"type":"illegal_argument_exception",
        "reason":"Fielddata is disabled on text fields by default. 
          Set fielddata=true on [updated_at] in order to load fielddata in memory 
          by uninverting the inverted index. Note that this can however use 
          significant memory. Alternatively use a keyword field instead."}
    }]
  },
  "status":400
}

我知道ElasticSearch documentation解释了如何解决此错误。但是,我想知道在这些环境中触发错误的原因是什么,因为所用的ES配置和查询在登台和生产中都是相同的。

0 个答案:

没有答案