问题描述
我正在尝试部分更新索引中已经存在且索引良好的现有文档,这意味着我可以在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效果很好。
解决方法
现在看来,对我有用的解决方案是将时间戳记字段格式从epoch_second
更改为strict_date_optional_time_nanos
。其他格式也可以使用。由于尝试重新编制索引时遇到相同的错误消息,因此我必须完全删除该索引并重新创建它。
如我的评论之一所述,我在此处提交了错误报告:
https://github.com/elastic/elasticsearch/issues/64050