You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

索引date_nanos字段值时触发Elasticsearch illegal_argument_exception异常

问题:Elasticsearch date_nanos字段无法解析合法纳秒时间戳

场景与配置

尝试索引采用纳秒级时间戳记录的OpenTelemetry数据,已通过GET /index/_mappings确认索引映射包含:

"startTimeUnixNano": {
    "type": "date_nanos"
},

异常情况

当索引包含如下值的文档时:

"startTimeUnixNano":1700860667233615872,

Elasticsearch抛出illegal_argument_exception异常:

{
    "error": {
        "root_cause":[
            {
                "type":"document_parsing_exception",
                "reason":"[1:1723] failed to parse field [resourceSpans.scopeSpans.spans.startTimeUnixNano] of type [date_nanos] in document with id 'OMxXDowB4M_uH230iKzE'. Preview of field's value: '1700860667233615872'"
            }
        ],
        "type":"document_parsing_exception",
        "reason":"[1:1723] failed to parse field [resourceSpans.scopeSpans.spans.startTimeUnixNano] of type [date_nanos] in document with id 'OMxXDowB4M_uH230iKzE'. Preview of field's value: '1700860667233615872'",
        "caused_by":{
            "type":"illegal_argument_exception",
            "reason":"date[+53900098-12-02T05:46:55.872Z] is after 2262-04-11T23:47:16.854775807 and cannot be stored in nanosecond resolution"
        }
    },
    "status":400
}

异常显示Elasticsearch将该时间戳解析成了远未来的日期,但明明已设置date_nanos类型,无法理解为何无法识别合法的纳秒级时间戳。

时间戳有效性验证

通过JavaScript验证该时间戳有效:

new Date(1700860667233615872 / 1000000)

得到的日期为2023年11月24日。


内容的提问来源于stack exchange,提问作者Chris White

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.05 12:56:17