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

**URL:** <https://discuss.elastic.co/t/java-time-migration-guide-upgrading-to-es-8-x/323942>\
**Category:** Elasticsearch\
**Created:** [January 25, 2023, 3:11pm UTC](https://discuss.elastic.co/t/java-time-migration-guide-upgrading-to-es-8-x/323942 "2023-01-25T15:11:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![YvorL](https://avatars.discourse-cdn.com/v4/letter/y/9fc348/32.png) [@YvorL](https://discuss.elastic.co/u/YvorL)\
**Post date:** [January 25, 2023, 3:11pm UTC](https://discuss.elastic.co/t/java-time-migration-guide-upgrading-to-es-8-x/323942/1 "2023-01-25T15:11:39Z")

</div>

Hi,

During reading release notes and breaking changes, I stumbled upon this guide: [Java time migration guide | Elasticsearch Guide [8.0] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/8.0/migrate-to-java-time.html)

At the [bottom](https://www.elastic.co/guide/en/elasticsearch/reference/8.0/migrate-to-java-time.html#java-time-migrate-update-mappings), 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](https://www.elastic.co/guide/en/elasticsearch/reference/8.6/date.html#multiple-date-formats) 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!

---

<div class="post-metadata">

**Author:** ![YvorL](https://avatars.discourse-cdn.com/v4/letter/y/9fc348/32.png) [@YvorL](https://discuss.elastic.co/u/YvorL)\
**Post date:** [January 30, 2023, 11:12am UTC](https://discuss.elastic.co/t/java-time-migration-guide-upgrading-to-es-8-x/323942/2 "2023-01-30T11:12:43Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![YvorL](https://avatars.discourse-cdn.com/v4/letter/y/9fc348/32.png) [@YvorL](https://discuss.elastic.co/u/YvorL)\
**Post date:** [February 1, 2023, 1:02pm UTC](https://discuss.elastic.co/t/java-time-migration-guide-upgrading-to-es-8-x/323942/3 "2023-02-01T13:02:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 1, 2023, 8:32pm UTC](https://discuss.elastic.co/t/java-time-migration-guide-upgrading-to-es-8-x/323942/4 "2023-02-01T20:32:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![YvorL](https://avatars.discourse-cdn.com/v4/letter/y/9fc348/32.png) [@YvorL](https://discuss.elastic.co/u/YvorL)\
**Post date:** [February 3, 2023, 11:27am UTC](https://discuss.elastic.co/t/java-time-migration-guide-upgrading-to-es-8-x/323942/5 "2023-02-03T11:27:31Z")

</div>

Thank you!

---

<div class="post-metadata">

**Author:** ![YvorL](https://avatars.discourse-cdn.com/v4/letter/y/9fc348/32.png) [@YvorL](https://discuss.elastic.co/u/YvorL)\
**Post date:** [February 7, 2023, 10:35am UTC](https://discuss.elastic.co/t/java-time-migration-guide-upgrading-to-es-8-x/323942/6 "2023-02-07T10:35:09Z")

</div>

`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](https://stackoverflow.com/questions/29014225)

The [recommendation](https://www.elastic.co/guide/en/elasticsearch/reference/8.0/migrate-to-java-time.html#java-time-migration-incompatible-date-formats) 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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 7, 2023, 10:35am UTC](https://discuss.elastic.co/t/java-time-migration-guide-upgrading-to-es-8-x/323942/7 "2023-03-07T10:35:58Z")

</div>

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