Use CLDR locale provider on JDK 23+ (#110222)

JDK 23 removes the COMPAT locale provider, leaving CLDR as the only option. This commit configures Elasticsearch
to use the CLDR provider when on JDK 23, but still use the existing COMPAT provider when on JDK 22 and below.

This causes some differences in locale behaviour; this also adapts various tests to still work whether run on COMPAT or CLDR.
This commit is contained in:
Simon Cooper 2024-09-04 13:42:40 +01:00 committed by GitHub
parent 0074c14bfa
commit a36d90cf34
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 73 additions and 92 deletions

View file

@ -12,7 +12,7 @@ setup:
day_of_week:
type: keyword
script: |
emit(doc['timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ROOT));
emit(doc['timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ENGLISH));
# Test fetching from _source
day_of_week_from_source:
type: keyword
@ -75,7 +75,7 @@ setup:
- match: {sensor.mappings.runtime.day_of_week.type: keyword }
- match:
sensor.mappings.runtime.day_of_week.script.source: |
emit(doc['timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ROOT));
emit(doc['timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ENGLISH));
- match: {sensor.mappings.runtime.day_of_week.script.lang: painless }
# --- TODO get field mappings needs to be adapted
@ -90,7 +90,7 @@ setup:
# type: keyword
# script:
# source: |
# emit(doc['timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ROOT));
# emit(doc['timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ENGLISH));
# lang: painless
# meta: {}
#

View file

@ -21,7 +21,7 @@ setup:
day_of_week:
type: keyword
script: |
emit(doc['timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ROOT));
emit(doc['timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ENGLISH));
# Test fetching from _source
day_of_week_from_source:
type: keyword
@ -74,7 +74,7 @@ setup:
- match: {sensor.mappings.properties.day_of_week.type: keyword }
- match:
sensor.mappings.properties.day_of_week.script.source: |
emit(doc['timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ROOT));
emit(doc['timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ENGLISH));
- match: {sensor.mappings.properties.day_of_week.script.lang: painless }
---

View file

@ -34,7 +34,7 @@ setup:
day_of_week:
type: keyword
script:
source: "emit(doc['timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ROOT))"
source: "emit(doc['timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ENGLISH))"
- match: {indices: ["test-1"]}
- length: {fields.timestamp: 1}
@ -78,7 +78,7 @@ setup:
day_of_week:
type: keyword
script:
source: "emit(doc['timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ROOT))"
source: "emit(doc['timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ENGLISH))"
- match: {indices: ["test-1", "test-2"]}
- length: {fields.day_of_week: 1}

View file

@ -12,7 +12,7 @@ setup:
day_of_week:
type: keyword
script: |
emit(doc['timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ROOT));
emit(doc['timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ENGLISH));
tomorrow:
type: date
script: