Mapping - error illegal_argument_exception when defining new date format

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 :slight_smile:

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!!

Did you delete your index before attempting to PUT the updated mapping? Elasticsearch does not allow field mappings to be modified. If you want to update the mapping, delete the index, then re-create the index with the modified mapping.

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