尝试对文档进行部分更新,但收到有关格式为 epoch_second 的日期字段的错误
Trying to parital update a doc but getting error regarding date field with epoch_second format
我正在尝试部分更新已在索引中且索引良好的现有文档,这意味着我可以在使用 timestamp
字段显示文档的 Kibana 中查看它。我正在尝试仅更新文档名称 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
不会产生此类错误并且更新插入效果很好。
目前看来,对我有用的解决方案是将时间戳字段格式从 epoch_second
更改为 strict_date_optional_time_nanos
。其他格式也可以。我不得不完全删除索引并重新创建它,因为我在尝试 re-index 时遇到了相同的错误消息。
正如我的一条评论中提到的,我在这里提交了一份错误报告:
https://github.com/elastic/elasticsearch/issues/64050
我正在尝试部分更新已在索引中且索引良好的现有文档,这意味着我可以在使用 timestamp
字段显示文档的 Kibana 中查看它。我正在尝试仅更新文档名称 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
不会产生此类错误并且更新插入效果很好。
目前看来,对我有用的解决方案是将时间戳字段格式从 epoch_second
更改为 strict_date_optional_time_nanos
。其他格式也可以。我不得不完全删除索引并重新创建它,因为我在尝试 re-index 时遇到了相同的错误消息。
正如我的一条评论中提到的,我在这里提交了一份错误报告:
https://github.com/elastic/elasticsearch/issues/64050