【发布时间】:2019-04-08 17:28:30
【问题描述】:
我使用错误的 @timestamp 字段错误地将大量文档提取到 Elasticsearch 中。我已经更改了受影响的 Logstash 管道以使用正确的时间戳,但我无法重新摄取旧数据。
不过,我确实有另一个文档字段可用作时间戳 (json.created_at)。所以我想更新这个领域。我发现我可以使用the _update_by_query 操作来做到这一点,但我尝试了几个不起作用的版本,包括这个:
POST logstash-rails_models-*/_update_by_query
{
"script": {
"lang": "painless",
"source": "ctx._source.@timestamp = ctx._source.json.created_at"
}
}
这抱怨一个意外的字符:
{
"error": {
"root_cause": [
{
"type": "script_exception",
"reason": "compile error",
"script_stack": [
"ctx._source.@timestamp = ctx._source. ...",
" ^---- HERE"
],
"script": "ctx._source.@timestamp = ctx._source.json.created_at",
"lang": "painless"
}
],
"type": "script_exception",
"reason": "compile error",
"script_stack": [
"ctx._source.@timestamp = ctx._source. ...",
" ^---- HERE"
],
"script": "ctx._source.@timestamp = ctx._source.json.created_at",
"lang": "painless",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "unexpected character [@].",
"caused_by": {
"type": "lexer_no_viable_alt_exception",
"reason": null
}
}
},
"status": 500
}
我该怎么办?
【问题讨论】:
标签: elasticsearch