Java time migration guide (upgrading to ES 8.x)

Hi,

During reading release notes and breaking changes, I stumbled upon this guide: Java time migration guide | Elasticsearch Guide [8.0] | Elastic

At the bottom, it says that the format

"yyyy/MM/dd HH:mm:ss||yyyy/MM/dd||epoch_millis"

Should be updated to:

"uuuu/MM/dd HH:mm:ss||uuuu/MM/dd||epoch_millis"

I checked the current doc on date formats, I still saw the first format. Given that we are years after the release of 7.0 I'm confused if I need to update my custom dates in a couple of indices:

"format" : "strict_date_optional_time||yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis",

and

"format" : "strict_date_optional_time||epoch_millis||dd/MMM/yyyy:HH:mm:ss Z||MMM dd HH:mm:ss||MMM d HH:mm:ss||dd-MMM-YYYY HH:mm:ss||YYYY-MM-dd HH:mm:ss,SSS||MM/dd/YYYY-HH:mm:ss.SSSSSS",

Could somebody tell me if this should be done and if it's blocking the upgrade?

Thanks!

Someone, please answer. I can't wait weeks for a simple question that some guys didn't follow up in the documentation or misinterpreted during writing the release notes.

Thanks!

@warkolm, sorry to tag you here, but could you please shed some light on my question?
Thank you!

I don't know sorry because after looking at the release notes and then the docs you refer to it is not consistent.

I would create a bug report in GitHub and reference this so it can be clarified and then fixed.

1 Like

Thank you!

y and u are both valid literals in Java time. y indicates "year of era" and u indicates "year". This Stackoverflow answer has a good explanation of the difference between the two: java 8 - What is the difference between year and year-of-era? - Stack Overflow

The recommendation is that if you were using Y in Joda time to indicate "year of era", you should now use y in Java time. And if you were using y in Joda time to indicate "year", you should now use u.

Nonetheless, because u and y are both valid in Java time, and behave similar for most use cases, I think the documentation is correct, and I will close this issue.

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