我正在尝试部分更新已经在索引中并且索引良好的现有文档,这意味着我可以在使用 timestamp
显示文档的字段。我只想更新医生的身份证 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
}
非常感谢您的帮助。谢谢。
编辑:添加索引Map
{
"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工作得很好。
1条答案
按热度按时间p3rjfoxz1#
现在看来,解决这个问题的方法是将时间戳字段的格式从
epoch_second
至strict_date_optional_time_nanos
. 其他格式也可以。我必须完全删除索引并重新创建它,因为我在尝试重新索引时遇到了相同的错误消息。正如我在评论中提到的,我在这里提交了一个bug报告:https://github.com/elastic/elasticsearch/issues/64050