Date format issue MMM D, YYYY h:mm:ss A

I'm facing the org.elasticsearch.index.mapper.MapperParsingException: failed to parse [date] - exception while loading the data to elastic search.

The date format used is a date: MMM D, YYYY h:mm:ss A.
The date value which I'm trying to load is Jan 3, 2019 4:34:34 PM.

I' not sure what is wrong here. I feel date input is exactly matching the format. But it is still failing.
I also tried using date: default format but it is also giving the same exception.

Please consult https://www.joda.org/joda-time/apidocs/org/joda/time/format/DateTimeFormat.html, referred here: https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html#custom-date-formats

For example, you should be using a instead of A for the AM/PM

As i have AM/PM values in capital i used A instead a. When i verified this format in Kibana - date format pattern, it was giving me the date as expected. I will try it with 'a' instead of 'A' to see if it works.

I'm going through https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html#built-in-date-formats. I think we should use strict date format always.

It is mentioned that - ' For instance a date like 5/11/1 would be considered invalid and would need to be rewritten to 2005/11/01 to be accepted by the date parser.' I will try this option as well to see if it works.

I was able to format the date by referring to the website. I got the working date format YYYY-MM-DD'T'HH:mm:ss.SSS.

I'm trying to add the Zone name (like CST) to the above date format by adding z. But YYYY-MM-DD'T'HH:mm:ss.SSSz is not working and I tried many variations but none of them are working for me. I was able to get the zone offset by using 'Z' but not Zone name.
Is the date format with zone name is not supported in elastic search?

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