我们有一个在staging
和production
两个相似的环境中运行的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配置和查询在登台和生产中都是相同的。