我正在尝试部分更新索引中已经存在且索引良好的现有文档,这意味着我可以在Kibana中使用timestamp
字段显示文档来查看它。我正在尝试仅更新ID为test_id
的文档名称
我的要求是:
POST shirkan_test/_update/test_id
{
"doc": {
"name": "shirkan"
},
"doc_as_upsert": true
}
出现以下错误:{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "failed to parse field [timestamp] of type [date] in document with id 'test_id'. Preview of field's value: '1.602505857664299E9'"
}
],
"type": "mapper_parsing_exception",
"reason": "failed to parse field [timestamp] of type [date] in document with id 'test_id'. Preview of field's value: '1.602505857664299E9'",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "failed to parse date field [1.602505857664299E9] with format [epoch_second]",
"caused_by": {
"type": "date_time_parse_exception",
"reason": "Failed to parse with all enclosed parsers"
}
}
},
"status": 400
}
非常感谢对此的任何帮助。谢谢。
编辑:添加索引映射
{
"mapping": {
"properties": {
"condition": {
"type": "text",
"index": false
},
"name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"rank": {
"type": "double"
},
"timestamp": {
"type": "date",
"format": "epoch_second"
}
}
}
}
编辑2 :将timestamp
格式更改为strict_date_optional_time_nanos
不会产生这样的错误,并且upsert效果很好。
最佳答案
现在看来,对我有用的解决方案是将timestamp字段格式从epoch_second
更改为strict_date_optional_time_nanos
。其他格式也可以使用。由于尝试重新编制索引时遇到相同的错误消息,因此我必须完全删除该索引并重新创建它。
如我的评论之一所述,我在此处提交了错误报告:
https://github.com/elastic/elasticsearch/issues/64050
关于elasticsearch - 尝试通过Parital更新文档,但是在获取有关epoch_second格式的日期字段时出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64463619/