Date format parse error

I'm getting Caused by: java.lang.IllegalArgumentException: failed to parse date field [Thu Jan 30 15:31:42 +00:00 2020] with format [strict_date_optional_time||epoch_millis||E M dd HH:mm:ss Z yyyy] when ingesting some data into Elasticsearch, but I can't figure out why.

I see the problematic date is Thu Jan 30 15:31:42 +00:00 2020 so I added E M dd HH:mm:ss Z yyyy as a custom date pattern. Shouldn't this pattern match the date? I haven't been able to find any good ways to test ES date pattern matching.

Hey,

try

EEE MMM dd HH:mm:ss XXX yyyy

I recently wrote a small tool to easier play with parsing date formats. It's available at https://esddd.herokuapp.com/

I tried the above datepattern in combination with Thu Jan 30 15:31:42 +00:00 2020 as the data to check, and the parsing worked.

As you can see java dates are a bit tricky with regards to the length of those letters (E vs. EEE) as those have different meanings how to interpret the input.

hope this helps!

Awesome, thanks! You guys should add your link to the date formatting docs! Very useful.

1 Like

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