Illegal_argument_exception while creating mapping in ES 6.4

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"
}
}
}
}
}
'

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.

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

@thinkdffrnt As long as your current data is formatted to be consistent with what the date field can ingest found here: Date Fields
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 ).

1 Like

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