elasticsearch - 尝试通过Parital更新文档,但是在获取有关epoch_second格式的日期字段时出现错误

标签 elasticsearch elasticsearch-mapping

我正在尝试部分更新索引中已经存在且索引良好的现有文档,这意味着我可以在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/

相关文章:

elasticsearch - 即使在logstash.conf中配置了文档ID,也没有在ElasticSearch中设置文档ID

elasticsearch - Logstash 多行无法正确解析 Oracle 日志

elasticsearch - 在 Elasticsearch 中选择一行

Elasticsearch 映射 - 重命名现有字段

elasticsearch - 有什么方法可以查看为什么我的v7.6 Elasticsearch映射不起作用并默认使用基本映射吗?

elasticsearch - 在 Elasticsearch 中映射解析器异常

Elasticsearch 查询性能

python - 使用 Python 的 elasticsearch 客户端批量更新

google-app-engine - google app engine flex 上的 Elasticsearch 部署

elasticsearch - Elasticsearch默认映射嵌套字段