Failed to parse date field [-386391600] with format [epoch_millis]

Hi all,

we have a problem with bulk requests:
[ElasticsearchException[Elasticsearch exception [type=mapper_parsing_exception, reason=failed to parse field [clientBirthday] of type [date] in document with id 'lBWSpo0B8qwsp5c23HPA'. Preview of field's value: '-386391600']]; nested: ElasticsearchException[Elasticsearch exception [type=illegal_argument_exception, reason=failed to parse date field [-386391600] with format [epoch_millis]]]; nested: ElasticsearchException[Elasticsearch exception [type=date_time_parse_exception, reason=date_time_parse_exception: Failed to parse with all enclosed parsers]];]

elasticSearch version 7.17.14
mapping
"clientBirthday": {
"type": "date",
"format": "epoch_millis"
},

How can we fix this problem?

Welcome!

I tried this in the developer console:

DELETE test 
PUT test
{
  "mappings": {
    "properties": {
      "clientBirthday": {
        "type": "date",
        "format": "epoch_millis"
      }
    }
  }
}
PUT /test/_doc/1
{
  "clientBirthday": -386391600
}

This gives:

{
  "_index": "test",
  "_id": "1",
  "_version": 1,
  "result": "created",
  "_shards": {
    "total": 2,
    "successful": 1,
    "failed": 0
  },
  "_seq_no": 0,
  "_primary_term": 1
}

So all good.
I tested with 8.12.1.

If the same exact script does not work with your version, try:

  • Update to the latest 7.17
  • or then Update to 8.12.1
1 Like

@dadoonet thank you for reply, but is there another way without updating?

What gives the exact same script on your cluster?

{
  "error" : {
    "root_cause" : [
      {
        "type" : "mapper_parsing_exception",
        "reason" : "failed to parse field [clientBirthday] of type [date] in document with id '1'. Preview of field's value: '-386391600'"
      }
    ],
    "type" : "mapper_parsing_exception",
    "reason" : "failed to parse field [clientBirthday] of type [date] in document with id '1'. Preview of field's value: '-386391600'",
    "caused_by" : {
      "type" : "illegal_argument_exception",
      "reason" : "failed to parse date field [-386391600] with format [epoch_millis]",
      "caused_by" : {
        "type" : "date_time_parse_exception",
        "reason" : "Failed to parse with all enclosed parsers"
      }
    }
  },
  "status" : 400
}

I don't think this is possible, according to some github issues the support for negative epoch was removed on version 7, but added back later on version 8.2.

You can check the PR that added it back here.

I got it, thanks everyone

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.