Date_time_parse_exception - Elasticsearch version 7.3.2

I have the mapping defined for "timestamp" field on ES as follows:
"timestamp": { "type": "date", "format": "yyyy-MM-dd HH:mm:ss Z" }
and I'm trying to index the following document,
{ "account":"170/170/78202", "timestamp":"2019-10-06T10:52:09-04:00" }

But getting exception as "failed to parse date field [2019-10-06T10:52:09-04:00] with format [yyyy-MM-dd HH:mm:ss Z]". In ES version 6.7, it worked well, but in 7.3.2, it doesn't work. Do we need to change in the way we index the date type values or need to adjust the mapping we defined in the index?

This does not work under 6.8 either, as you time format does not match the date.

The format does not mention a T but a whitespace between date and time and also there is no whitespace between the time and the timezone, which is expected in the mapping format.

@spinscale, even with the following format, it throws the same error
'{"account":"170/170/78202","timestamp":"2019-10-06 10:52:09 -04:00"}'

`failed to parse date field [2019-10-06 10:52:09 -04:00] with f ormat [yyyy-MM-dd HH:mm:ss Z]'

This is due to the switch from joda to java time with regards to parsing. Try using XXX as the timezone and make sure you read the java time docs for proper formatter definition at https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html (and not the joda ones)

The problem was with the colon( : ) in the timezone value. I've removed that and it worked.
'{"account":"170/170/78202","timestamp":"2019-10-06 10:52:09 -0400"}'

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