# Illegal\_argument\_exception while creating mapping in ES 6.4

**URL:** <https://discuss.elastic.co/t/illegal-argument-exception-while-creating-mapping-in-es-6-4/152546>\
**Category:** Elasticsearch\
**Created:** [October 15, 2018, 6:50pm UTC](https://discuss.elastic.co/t/illegal-argument-exception-while-creating-mapping-in-es-6-4/152546 "2018-10-15T18:50:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![thinkdffrnt](https://avatars.discourse-cdn.com/v4/letter/t/82dd89/32.png) [@thinkdffrnt](https://discuss.elastic.co/u/thinkdffrnt)\
**Post date:** [October 15, 2018, 6:50pm UTC](https://discuss.elastic.co/t/illegal-argument-exception-while-creating-mapping-in-es-6-4/152546/1 "2018-10-15T18:50:44Z")

</div>

Hi, I'm trying to create a date mapping in ES 6.4 version.  
I keep getting the below error. Can someone please guide me

> {"error":{"root\_cause":[{"type":"mapper\_parsing\_exception","reason":"Failed to parse mapping [mymapping]: Invalid format: [yyyy-MM-ddTHH:mm:ssZZ]: Illegal pattern component: T"}],"type":"mapper\_parsing\_exception","reason":"Failed to parse mapping [mymapping]: Invalid format: [yyyy-MM-ddTHH:mm:ssZZ]: Illegal pattern component: T","caused\_by":{"type":"illegal\_argument\_exception","reason":"Invalid format: [yyyy-MM-ddTHH:mm:ssZZ]: Illegal pattern component: T","caused\_by":{"type":"illegal\_argument\_exception","reason":"Illegal pattern component: T"}}},"status":400}

> curl -X PUT "localhost:9200/my\_index" -H 'Content-Type: application/json' -d'  
> {  
> "mappings": {  
> "mymapping": {  
> "properties": {  
> "mydate": {  
> "type": "date",  
> "format": "yyyy-MM-dd'T'HH:mm:ssZ"  
> }  
> }  
> }  
> }  
> }  
> '

---

<div class="post-metadata">

**Author:** ![MPurcell](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@MPurcell](https://discuss.elastic.co/u/MPurcell)\
**Post date:** [October 15, 2018, 7:13pm UTC](https://discuss.elastic.co/t/illegal-argument-exception-while-creating-mapping-in-es-6-4/152546/2 "2018-10-15T19:13:37Z")

</div>

Try the curl command without specifying format @thinkdffrnt. You can still utilize that format during ETL, but you don't need to specify anything else other then "type": "date" for that specific field.

---

<div class="post-metadata">

**Author:** ![thinkdffrnt](https://avatars.discourse-cdn.com/v4/letter/t/82dd89/32.png) [@thinkdffrnt](https://discuss.elastic.co/u/thinkdffrnt)\
**Post date:** [October 15, 2018, 7:19pm UTC](https://discuss.elastic.co/t/illegal-argument-exception-while-creating-mapping-in-es-6-4/152546/3 "2018-10-15T19:19:42Z")

</div>

Thank you @MPurcell I'm creating this mapping for cluster migration from 6.1 to 6.4. Would reindexing handle in that case?

---

<div class="post-metadata">

**Author:** ![MPurcell](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@MPurcell](https://discuss.elastic.co/u/MPurcell)\
**Post date:** [October 15, 2018, 7:53pm UTC](https://discuss.elastic.co/t/illegal-argument-exception-while-creating-mapping-in-es-6-4/152546/4 "2018-10-15T19:53:16Z")

</div>

@thinkdffrnt As long as your current data is formatted to be consistent with what the date field can ingest found here: [Date Fields](https://www.elastic.co/guide/en/elasticsearch/reference/current/date.html)  
then you should have no issues. Just remember you don't need to specify the format, you only need to specify "type" : "date". As far as I can tell, nothing has changed between 6.1 ~ 6.4 that would cause issues with cluster migration ( in respect to field data types ).

---

<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:** [November 12, 2018, 7:53pm UTC](https://discuss.elastic.co/t/illegal-argument-exception-while-creating-mapping-in-es-6-4/152546/5 "2018-11-12T19:53:17Z")

</div>

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