# Mapping - error illegal\_argument\_exception when defining new date forma

**URL:** <https://discuss.elastic.co/t/mapping-error-illegal-argument-exception-when-defining-new-date-forma/130736>\
**Category:** Elasticsearch\
**Created:** [May 6, 2018, 8:47am UTC](https://discuss.elastic.co/t/mapping-error-illegal-argument-exception-when-defining-new-date-forma/130736 "2018-05-06T08:47:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aviyoosh](https://avatars.discourse-cdn.com/v4/letter/a/c37758/32.png) [@Aviyoosh](https://discuss.elastic.co/u/Aviyoosh)\
**Post date:** [May 6, 2018, 8:47am UTC](https://discuss.elastic.co/t/mapping-error-illegal-argument-exception-when-defining-new-date-forma/130736/1 "2018-05-06T08:47:59Z")

</div>

Kibana + Elastic version: 6.2.4  
JDK version: 10.0.1  
OS version: Win10

Hi,  
I'm new to this world so please be gentle 🙂

when trying to add a date format, I generated both queries:  
this one worked:  
put /product/default/\_mapping  
{  
"properties": {  
"created": {  
"type": "date",  
"format": "strict\_date\_optional\_time||epoch\_millis"  
}  
}  
}

this one didn't work:

PUT /product/default/\_mapping  
{  
"properties": {  
"created": {  
"type": "date",  
"format": "yyyy/MM/dd HH:mm:ss||yyyy/MM/dd"  
}  
}  
}

the only difference is the date format, which i don't understand why for the second i get the below error:  
{  
"error": {  
"root\_cause": [  
{  
"type": "illegal\_argument\_exception",  
"reason": "Mapper for [created] conflicts with existing mapping in other types:\n[mapper [created] has different [format] values]"  
}  
],  
"type": "illegal\_argument\_exception",  
"reason": "Mapper for [created] conflicts with existing mapping in other types:\n[mapper [created] has different [format] values]"  
},  
"status": 400  
}

thanks!!

---

<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:** [May 6, 2018, 9:49am UTC](https://discuss.elastic.co/t/mapping-error-illegal-argument-exception-when-defining-new-date-forma/130736/2 "2018-05-06T09:49:54Z")

</div>

You can't change an existing mapping.  
You need to delete and recreate again the index.

I moved your post to #elasticsearch

---

<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 5, 2018, 9:50am UTC](https://discuss.elastic.co/t/mapping-error-illegal-argument-exception-when-defining-new-date-forma/130736/3 "2018-06-05T09:50:02Z")

</div>

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