[doc] Improve joda-time migration guide (#60499)
Previously migration guide incorrectly stated that joda-time patterns have to be fixed before upgrading to 7.x since (7.7) #52555 and our bwc policy 6.x created indices even with joda-time are supported relates #60374
This commit is contained in:
parent
890f943d0f
commit
62baca74ed
|
@ -5,16 +5,23 @@ With 7.0, {es} switched from joda time to java time for date-related parsing,
|
|||
formatting, and calculations. This guide is designed to help you determine
|
||||
if your cluster is impacted and, if so, prepare for the upgrade.
|
||||
|
||||
You do not need to convert joda-time date formats to java time for indices
|
||||
created in {es} 6.8 before upgrading to 7.7 or later versions. However, mappings
|
||||
for indices created in 7.7 and later versions must use java-time formats.
|
||||
|
||||
To ensure new indices use java-time formats, we recommend you update any ingest
|
||||
pipelines and index templates created in 6.8 to java time before upgrading. See:
|
||||
|
||||
* <<java-time-migration-update-ingest-pipelines>>
|
||||
* <<java-time-migration-update-index-templates>>
|
||||
|
||||
Indices created in versions 7.0-7.6 cannot use joda time. This was fixed
|
||||
was in 7.7 with {es-pull}52555[#52555].
|
||||
[discrete]
|
||||
[[java-time-convert-date-formats]]
|
||||
=== Convert date formats
|
||||
|
||||
To upgrade to 7.0, you'll need to convert any joda-time date formats
|
||||
to their java-time equivalents.
|
||||
|
||||
To help track this effort, you can prefix java-time date formats with an `8`
|
||||
in {es} 6.8 and later versions.
|
||||
|
||||
To use java time in 6.8, prefix the date format with an `8`.
|
||||
For example, you can change the date format `YYYY-MM-dd` to `8yyyy-MM-dd` to
|
||||
indicate the date format uses java time.
|
||||
|
||||
|
@ -51,7 +58,7 @@ or the {kibana-ref}/upgrade-assistant.html[Kibana upgrade assistant].
|
|||
[[java-time-migration-incompatible-date-formats]]
|
||||
==== Incompatible date formats
|
||||
Custom date formats containing the following joda-time literals should be
|
||||
changed before upgrading.
|
||||
converted to their java-time equivalents.
|
||||
|
||||
`Y` (Year of era)::
|
||||
+
|
||||
|
@ -94,7 +101,7 @@ There is no replacement. Instead, we recommend you preprocess your input.
|
|||
--
|
||||
Replace with `Y`.
|
||||
|
||||
In java time, `x` means https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html[zone-offset].
|
||||
In java time, `x` means https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html[zone-offset].
|
||||
|
||||
[WARNING]
|
||||
====
|
||||
|
@ -174,7 +181,7 @@ yyyy-MM-dd||yyyy-MM-d
|
|||
|
||||
In java time, `d` also does not accept more than 2 digits. To accept days with more
|
||||
than two digits, you must include a text literal in your java-time date format.
|
||||
For example, to parse `2010-01-00001`, you must use the following java-time date format:
|
||||
For example, to parse `2010-01-00001`, you must use the following java-time date format:
|
||||
|
||||
[source,txt]
|
||||
--------------------------------------------------
|
||||
|
@ -192,7 +199,7 @@ For example, the joda-time date format `EEE YYYY-MM` accepts both
|
|||
`Wed 2020-01` and `Wednesday 2020-01`.
|
||||
|
||||
To accept both of these dates in java time, you must specify each format using
|
||||
the `||` delimiter:
|
||||
the `||` delimiter:
|
||||
|
||||
[source,txt]
|
||||
--------------------------------------------------
|
||||
|
@ -278,8 +285,8 @@ GET my-index-000001/_mapping
|
|||
To change the date format for the `datetime` field, create a separate index
|
||||
containing an updated mapping and date format.
|
||||
|
||||
For example, the following `my-index-000002` index changes the `datetime` field's
|
||||
date format to `8uuuu/MM/dd HH:mm:ss||uuuu/MM/dd||epoch_millis`. The `8` prefix
|
||||
For example, the following `my-index-000002` index changes the `datetime` field's
|
||||
date format to `8uuuu/MM/dd HH:mm:ss||uuuu/MM/dd||epoch_millis`. The `8` prefix
|
||||
indicates this date format uses java time.
|
||||
|
||||
[source,console]
|
||||
|
|
Loading…
Reference in New Issue