# Failed to parse date field \[-386391600\] with format \[epoch\_millis\]

**URL:** <https://discuss.elastic.co/t/failed-to-parse-date-field-386391600-with-format-epoch-millis/353444>\
**Category:** Elasticsearch\
**Created:** [February 16, 2024, 8:49am UTC](https://discuss.elastic.co/t/failed-to-parse-date-field-386391600-with-format-epoch-millis/353444 "2024-02-16T08:49:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![persik665](https://avatars.discourse-cdn.com/v4/letter/p/258eb7/32.png) [@persik665](https://discuss.elastic.co/u/persik665)\
**Post date:** [February 16, 2024, 8:49am UTC](https://discuss.elastic.co/t/failed-to-parse-date-field-386391600-with-format-epoch-millis/353444/1 "2024-02-16T08:49:22Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 16, 2024, 1:17pm UTC](https://discuss.elastic.co/t/failed-to-parse-date-field-386391600-with-format-epoch-millis/353444/2 "2024-02-16T13:17:52Z")

</div>

Welcome!

I tried this in the developer console:

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

```

This gives:

```auto
{
  "_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

---

<div class="post-metadata">

**Author:** ![persik665](https://avatars.discourse-cdn.com/v4/letter/p/258eb7/32.png) [@persik665](https://discuss.elastic.co/u/persik665)\
**Post date:** [February 20, 2024, 7:56am UTC](https://discuss.elastic.co/t/failed-to-parse-date-field-386391600-with-format-epoch-millis/353444/3 "2024-02-20T07:56:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 20, 2024, 11:03am UTC](https://discuss.elastic.co/t/failed-to-parse-date-field-386391600-with-format-epoch-millis/353444/4 "2024-02-20T11:03:44Z")

</div>

What gives the exact same script on your cluster?

---

<div class="post-metadata">

**Author:** ![persik665](https://avatars.discourse-cdn.com/v4/letter/p/258eb7/32.png) [@persik665](https://discuss.elastic.co/u/persik665)\
**Post date:** [February 20, 2024, 1:42pm UTC](https://discuss.elastic.co/t/failed-to-parse-date-field-386391600-with-format-epoch-millis/353444/5 "2024-02-20T13:42:43Z")

</div>

```auto
{
  "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
}

```

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [February 20, 2024, 2:00pm UTC](https://discuss.elastic.co/t/failed-to-parse-date-field-386391600-with-format-epoch-millis/353444/6 "2024-02-20T14:00:38Z")

</div>

> [@persik665](#):
>
> there another way without updating?

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](https://github.com/elastic/elasticsearch/pull/80208).

---

<div class="post-metadata">

**Author:** ![persik665](https://avatars.discourse-cdn.com/v4/letter/p/258eb7/32.png) [@persik665](https://discuss.elastic.co/u/persik665)\
**Post date:** [February 20, 2024, 2:23pm UTC](https://discuss.elastic.co/t/failed-to-parse-date-field-386391600-with-format-epoch-millis/353444/7 "2024-02-20T14:23:35Z")

</div>

I got it, thanks everyone

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 19, 2024, 2:23pm UTC](https://discuss.elastic.co/t/failed-to-parse-date-field-386391600-with-format-epoch-millis/353444/8 "2024-03-19T14:23:37Z")

</div>

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