elasticsearch failed to parse date

BoCode picture BoCode · Mar 18, 2015 · Viewed 23.8k times · Source

I've the following index definition for the date:

"handshaketime" : {"type":"date","format":"YYYY-MM-ddTHH:mm:ss.SSSZ"}

And the actual date is of this form:

"handshaketime":"2015-04-07T10:43:03.000-07:00"

I've specified that date coming from DB has the above mentioned format but elasticsearch still gives me the following error.

Caused by: org.elasticsearch.index.mapper.MapperParsingException: failed to
parse date field [2015-04-07T10:43:03.000-07:00], tried both date format
[YYYY-MM-dd HH:mm:ss], and timestamp number with locale []

I'm using elasticsearch 1.4.4 with jdbc_river 1.4.0.10.

Please tell me whats going on.

Answer

BoCode picture BoCode · Mar 18, 2015

In trying to fix this error, I came across the same result, despite what @Vineeth provided. I pointed to him that for some reason ES is not showing the format that we supplied but instead gives the same error over and over again.

Finally, I came across a post describing the removal of all indexes in ES and re-submitting our index/mapping document afresh (aka clean-slating). Voila! it worked, in fact it worked if i just gave the following:

"handshaketime":{"type":"date", "format": "dateOptionalTime"}

Not even custom format that me and @Vineeth were discussing about!!

So if you are struggling with this problem, make sure there are NO indexes in the ES that may be preventing you to index your new document.

Thanks for trying to sort this issue @Vineeth.