-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Description
Objective: In order to support nanosecond resolution and to remove the joda time dependency from Elasticsearch, we need to migrate a lot of code over to java.time.
This is a meta issue detailing the steps that need to be taken to migrate away from joda time and to java.time.
There are a few things to keep in mind and discuss before outlining the single steps
Retaining our gazillion date formats
Do we want to retain the tons of our named date formats, named very well like strictOrdinalDateTimeNoMillis or strictWeekDateTimeNoMillis (also we support snake and camel case for each of those!)? I think we could built a layer that is still able to read those, but then maybe convert it to formatted dates like xxxx-'W'ww-e'T'HH:mm:ssZZ (just an example). This way we could get rid of this mapping entirely or at least just maintain it for a few examples like epoch_millis, epoch_second and dateOptionalTime as the text representation are nowhere near as readable as the date time formats, once internalized.
You can find the full list in the Joda class
BWC breaking
Some classes used by builders to create queries are using joda time classes. As we move towards the REST client and away from the Transport Client this will be less of an BWC issue.
Steps
- Ensure time zones are parsed the same way in joda and java.time, other wise the timezone parameters i.e. from the query string query/aggregations could act differently
- Make
DateMathParserusejava.time - Make
IndexNameExpressionResolver.DateMathExpressionResolveruse java.time, also remove the check for thedate_math_expression_resolver.default_time_zoneanddate_math_expression_resolver.default_date_formatsettings here (they are not registered anyway). Core: Move IndexNameExpressionResolver to java time #34507 - Ensure new java time
IndexNameExpressionResolveris BWC compatible when formatters are used - Convert field mapper types to use
ZonedDateTimeCore: Switch mapping/aggregations over to java time #36363 - Convert
DateTimeUnit,Rounding,TimeValueclasses - Convert
XContentBuilder,StreamInput,StreamOutputclasses (the serialized version of this is just a long and a timezone in our streams, so those are easy to convert. Same applies for the XContentBuilder) - Convert the cat API classes (super easy, mostly just formatters, that get their input as milliseconds)
-
SortingNumericDocValuesand classes extending from it in the fielddata package need to be converted (or removed?) Core: Switch mapping/aggregations over to java time #36363 - Replace joda with java.time in painless
- Replace joda with java.time in ingest Replace joda time in ingest-common module #38088
- Mapping: Replace in
DocValueFormatandDateFieldMapperCore: Switch mapping/aggregations over to java time #36363 - Remove jodatime dependency
- Add support to nanosecond resolution, add new date format time that supports nanoseconds and ensure that the formatter supports it properly Core: Add new nanosecond supporting field mapper #32601
- Remove usages of joda in x-pack/ML package Core: Switch mapping/aggregations over to java time #36363 (partially)
- Remove usages of joda in Monitoring Core: Migrating from joda to java.time. Monitoring plugin #36297
- Remove usages of joda in Watcher Migrating from joda to java.time. Watcher plugin #35809
- Refactor DateHistograms bucket aggregations to use java.time Core: Switch mapping/aggregations over to java time #36363