# Elatic mapper\_parsing\_exception

**URL:** <https://discuss.elastic.co/t/elatic-mapper-parsing-exception/231414>\
**Category:** Elasticsearch\
**Created:** [May 6, 2020, 9:23pm UTC](https://discuss.elastic.co/t/elatic-mapper-parsing-exception/231414 "2020-05-06T21:23:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![savvy](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@savvy](https://discuss.elastic.co/u/savvy)\
**Post date:** [May 6, 2020, 9:23pm UTC](https://discuss.elastic.co/t/elatic-mapper-parsing-exception/231414/1 "2020-05-06T21:23:09Z")

</div>

[2020-05-06T17:16:33,007][WARN][logstash.outputs.elasticsearch][mykafka] Could not index event to Elasticsearch. {:status=\>400, :action=\>["index", {:\_id=\>nil, :\_index=\>"mydata-day-2020.05.06-113", :routing=\>nil, :\_type=\>"\_doc"}, #LogStash::Event:0x4f163538], :response=\>{"index"=\>{"\_index"=\>"mydata-day-2020.05.06-113", "\_type"=\>"\_doc", "\_id"=\>"-s\_Y63EBQO9FwNtA5t0Z", "status"=\>400, "error"=\>{"type"=\>"mapper\_parsing\_exception", "reason"=\>"failed to parse field [abc.timestamp] of type [date\_nanos] in document with id '-s\_Y63EBQO9FwNtA5t0Z'. Preview of field's value: ''2020-05-06T01:46:37.357884414Z''", "caused\_by"=\>{"type"=\>"illegal\_argument\_exception", "reason"=\>"failed to parse date field ['2020-05-06T01:46:37.357884414Z'] with format [yyyy-MM-dd HH:mm:ss.SSSSSSSSS Z || yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSSZ]", "caused\_by"=\>{"type"=\>"date\_time\_parse\_exception", "reason"=\>"date\_time\_parse\_exception: Failed to parse with all enclosed parsers"}}}}}}

Using elastic 7.5.1 - Using below template  
{  
"order": 2,  
"index\_patterns": [  
"mydata\*"  
],  
"settings": {  
"index": {  
"refresh\_interval": "5s"  
}  
},  
"mappings": {  
"properties": {  
"abc.timestamp": {  
"format": "yyyy-MM-dd HH:mm:ss.SSSSSSSSS Z || yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSSZ",  
"type": "date\_nanos"  
}  
}  
},  
"aliases": {}  
}

What format should I be using?

---

<div class="post-metadata">

**Author:** ![Luca\_Belluccini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luca_belluccini/32/33239_2.png) [@Luca\_Belluccini](https://discuss.elastic.co/u/Luca_Belluccini)\
**Post date:** [May 7, 2020, 12:25am UTC](https://discuss.elastic.co/t/elatic-mapper-parsing-exception/231414/2 "2020-05-07T00:25:40Z")

</div>

Hello @savvy

On 7.x, the date formats must be converted to Java Time as detailed [here](https://www.elastic.co/guide/en/elasticsearch/reference/7.x/migrate-to-java-time.html)

You can use the following tool to convert the formats from Joda to Java time: [https://esddd.herokuapp.com/](https://esddd.herokuapp.com/)

```auto
DELETE timenanos
PUT timenanos
{
  "settings": {
    "index": {
      "refresh_interval": "5s"
    }
  },
  "mappings": {
    "properties": {
      "abc": {
        "properties": {
          "timestamp": {
            "format": "uuuu-MM-dd HH:mm:ss.SSSSSSSSS X||yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSSX",
            "type": "date_nanos"
          }
        }
      }
    }
  }
}

POST timenanos/_doc/1
{
  "abc": {
    "timestamp": "2020-05-06T01:46:37.357884414Z"
  }
}
POST timenanos/_doc/2
{
  "abc": {
    "timestamp": "2020-05-06 01:46:37.357884414 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:** [June 4, 2020, 12:31am UTC](https://discuss.elastic.co/t/elatic-mapper-parsing-exception/231414/3 "2020-06-04T00:31:53Z")

</div>

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