# Date format error from elasticsearch

**URL:** https://discuss.elastic.co/t/date-format-error-from-elasticsearch/263307
**Category:** Elasticsearch
**Created:** [February 4, 2021, 10:39pm UTC](https://discuss.elastic.co/t/date-format-error-from-elasticsearch/263307 "2021-02-04T22:39:31Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![earlsanchez](https://avatars.discourse-cdn.com/v4/letter/e/b9e5f3/32.png) [@earlsanchez](https://discuss.elastic.co/u/earlsanchez)
#### Post date: [February 4, 2021, 10:39pm UTC](https://discuss.elastic.co/t/date-format-error-from-elasticsearch/263307/1 "2021-02-04T22:39:32Z")

</div>

Hello,  
I originally posted this in the Logstash forum but it was suggested that I should post in Elasticsearch instead.

I'm getting a date format error from elasticsearch but the format seems to match the posted date object. Can some one see specifically what it is complaining about?

Return error from Elasticsearch:

```auto
{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"failed to parse field [date] of type [date] in document with id 'KGcZb3cBqhj6kAxank_x'. Preview of field's value: '2021-04-02T07:18:45.000Z'"}],"type":"mapper_parsing_exception","reason":"failed to parse field [date] of type [date] in document with id 'KGcZb3cBqhj6kAxank_x'. Preview of field's value: '2021-04-02T07:18:45.000Z'","caused_by":{"type":"illegal_argument_exception","reason":"failed to parse date field [2021-04-02T07:18:45.000Z] with format [yyyy-MM-dd'T'HH:mm:ss.SSSZ||yyyy-MM-dd HH:mm:ss,SSS||yyyy/MM/dd HH:mm:ss||yyyy-MM-dd'T'HH:mm:ss.SSSZZZ||yyyy-MM-dd||epoch_millis]","caused_by":{"type":"date_time_parse_exception","reason":"Failed to parse with all enclosed parsers"}}},"status":400}

```

Here is the document I'm posting:

```auto
{
       "message":"2021/02/04 07:18:45 | xxxxxxxx.xxxxxxxx.PDF.1612451907436 INFO com.ixiasoft.outputgenerator.preprocessor.AntProcessor - Done Processing AntProcessor. wkdy.dita2pdf",
     "exception":"Done Processing AntProcessor. wkdy.dita2pdf",
      "loglevel":"INFO",
          "host.name":"logstash-dev-poc",
       "service":"xxxxxxxx.xxxxxxxx.PDF.1612451907436",
    "@timestamp":"2021-02-04T19:44:07.822Z",
        "logger":"com.ixiasoft.outputgenerator.preprocessor.AntProcessor",
          "date":"2021-04-02T07:18:45.000Z"
}

```

It seems "date" should match on this format string?  
"yyyy-MM-dd'T'HH:mm:ss.SSSZ"

Here is the "date" index mapping:

```auto
        "date" : {
          "type" : "date",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          },
          "format" : "yyyy-MM-dd'T'HH:mm:ss.SSSZ||yyyy-MM-dd HH:mm:ss,SSS||yyyy/MM/dd HH:mm:ss||yyyy-MM-dd'T'HH:mm:ss.SSSZZZ||yyyy-MM-dd||epoch_millis"
        },

```

TIA!

---

<div class="post-metadata">

### Author: ![AClerk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aclerk/32/55297_2.png) [@AClerk](https://discuss.elastic.co/u/AClerk)
#### Post date: [February 4, 2021, 10:58pm UTC](https://discuss.elastic.co/t/date-format-error-from-elasticsearch/263307/2 "2021-02-04T22:58:22Z")

</div>

> [@earlsanchez](#):
>
> `Failed to parse with all enclosed parsers`

Seen [this](https://discuss.elastic.co/t/the-curse-of-dynamic-dates/177633)?

---

<div class="post-metadata">

### Author: ![earlsanchez](https://avatars.discourse-cdn.com/v4/letter/e/b9e5f3/32.png) [@earlsanchez](https://discuss.elastic.co/u/earlsanchez)
#### Post date: [February 4, 2021, 11:32pm UTC](https://discuss.elastic.co/t/date-format-error-from-elasticsearch/263307/3 "2021-02-04T23:32:11Z")

</div>

Correct solution from @Badger in Logstash forum:

Z would match `-0700` . Try `yyyy-MM-dd'T'HH:mm:ss.SSS'Z'`

---

<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 4, 2021, 11:32pm UTC](https://discuss.elastic.co/t/date-format-error-from-elasticsearch/263307/4 "2021-03-04T23:32:56Z")

</div>

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