-
Notifications
You must be signed in to change notification settings - Fork 25.5k
Add some information on locale database to the ES docs #113587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6a60795
Add some information on locale database
thecoop a6e3b9f
Add more info to format docs
thecoop 8f11c69
Merge remote-tracking branch 'upstream/8.x' into locale-docs
thecoop eae18d3
Update docs link
thecoop 5e3cd28
Update links
thecoop 23ada6b
Merge remote-tracking branch 'upstream/8.x' into locale-docs
thecoop 2f7ef9c
Add breaking change note
thecoop File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,8 +31,38 @@ down to the nearest day. | |
[[custom-date-formats]] | ||
==== Custom date formats | ||
|
||
Completely customizable date formats are supported. The syntax for these is explained | ||
https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html[DateTimeFormatter docs]. | ||
Completely customizable date formats are supported. The syntax for these is explained in | ||
https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/format/DateTimeFormatter.html[DateTimeFormatter docs]. | ||
|
||
[[custom-date-format-locales]] | ||
===== Differences in locale information between JDK versions | ||
|
||
There can be some differences in date formats between JDK versions and different locales. In particular, | ||
there can be differences in text strings used for textual date formats, and there can be differences | ||
in the results of week-date calculations. | ||
|
||
There can be differences in text strings used by the following field specifiers: | ||
|
||
* `B`, `E`, `G`, `O`, `a`, `v`, `z` of any length | ||
* `L`, `M`, `Q`, `q`, `c`, `e` of length 3 or greater | ||
* `Z` of length 4 | ||
|
||
If the text format changes between Elasticsearch or JDK versions, it can cause significant problems | ||
with ingest, output, and re-indexing. It is recommended to always use numerical fields in custom date formats, | ||
which are not affected by locale information. | ||
|
||
There can also be differences in week-date calculations using the `Y`, `W`, and `w` field specifiers. | ||
The underlying data used to calculate week-dates can vary depending on the JDK version and locale; | ||
this can cause differences in the calculated week-date for the same calendar dates. | ||
It is recommended that the built-in week-date formats are used, which will always use ISO rules | ||
for calculating week-dates. | ||
|
||
In particular, there is a significant change in locale information between JDK releases 22 and 23. | ||
Elasticsearch will use the _COMPAT_ locale database when run on JDK 22 and before, | ||
and will use the _CLDR_ locale database when run on JDK 23 and above. This change can cause significant differences | ||
to the textual date formats accepted by Elasticsearch, and to calculated week-dates. If you are using | ||
affected specifiers, you may need to modify your ingest or output integration code to account | ||
for the differences between these two JDK versions. | ||
|
||
[[built-in-date-formats]] | ||
==== Built In Formats | ||
|
@@ -256,31 +286,37 @@ The following tables lists all the defaults ISO formats supported: | |
`week_date` or `strict_week_date`:: | ||
|
||
A formatter for a full date as four digit weekyear, two digit week of | ||
weekyear, and one digit day of week: `xxxx-'W'ww-e`. | ||
weekyear, and one digit day of week: `YYYY-'W'ww-e`. | ||
This uses the ISO week-date definition. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
|
||
`week_date_time` or `strict_week_date_time`:: | ||
|
||
A formatter that combines a full weekyear date and time, separated by a | ||
'T': `xxxx-'W'ww-e'T'HH:mm:ss.SSSZ`. | ||
'T': `YYYY-'W'ww-e'T'HH:mm:ss.SSSZ`. | ||
This uses the ISO week-date definition. | ||
|
||
`week_date_time_no_millis` or `strict_week_date_time_no_millis`:: | ||
|
||
A formatter that combines a full weekyear date and time without millis, | ||
separated by a 'T': `xxxx-'W'ww-e'T'HH:mm:ssZ`. | ||
separated by a 'T': `YYYY-'W'ww-e'T'HH:mm:ssZ`. | ||
This uses the ISO week-date definition. | ||
|
||
`weekyear` or `strict_weekyear`:: | ||
|
||
A formatter for a four digit weekyear: `xxxx`. | ||
A formatter for a four digit weekyear: `YYYY`. | ||
This uses the ISO week-date definition. | ||
|
||
`weekyear_week` or `strict_weekyear_week`:: | ||
|
||
A formatter for a four digit weekyear and two digit week of weekyear: | ||
`xxxx-'W'ww`. | ||
`YYYY-'W'ww`. | ||
This uses the ISO week-date definition. | ||
|
||
`weekyear_week_day` or `strict_weekyear_week_day`:: | ||
|
||
A formatter for a four digit weekyear, two digit week of weekyear, and one | ||
digit day of week: `xxxx-'W'ww-e`. | ||
digit day of week: `YYYY-'W'ww-e`. | ||
This uses the ISO week-date definition. | ||
|
||
`year` or `strict_year`:: | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love how explicit the list of field specifiers is.
Would it make sense to word this advice such that we could add these three stragglers to the bullet list above, to provide one-stop-shopping for users who want to ensure they avoid this problem? I could envision a user swiping the above list and pasting it into a Jira ticket, thereby missing these three.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly, however the effects are quite different for each type, and I expect users to read the whole doc