我们有一个 Rails 4 应用程序在两个类似的环境中运行,staging
并且production
.
最近,这个错误开始出现在本地开发环境和暂存环境中,但在生产环境中没有发生。
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 文档解释了如何解决这个错误。但是,我想知道在这些环境中触发错误的原因是什么,因为使用的 ES 配置和查询在登台和生产中是相同的。