Skip to content

Commit 693c3a3

Browse files
committed
[Followup] Store arrays offsets for keyword fields natively with synthetic source
Update index version check after elastic#122997 backport was merged.
1 parent 5de46d1 commit 693c3a3

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

server/src/main/java/org/elasticsearch/index/IndexVersions.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ private static Version parseUnchecked(String version) {
135135
public static final IndexVersion INFERENCE_METADATA_FIELDS_BACKPORT = def(8_524_0_00, parseUnchecked("9.12.1"));
136136
public static final IndexVersion LOGSB_OPTIONAL_SORTING_ON_HOST_NAME_BACKPORT = def(8_525_0_00, parseUnchecked("9.12.1"));
137137
public static final IndexVersion USE_SYNTHETIC_SOURCE_FOR_RECOVERY_BY_DEFAULT_BACKPORT = def(8_526_0_00, parseUnchecked("9.12.1"));
138+
public static final IndexVersion SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_KEYWORD_BACKPORT_8_X = def(8_527_0_00, Version.LUCENE_9_12_1);
138139
public static final IndexVersion UPGRADE_TO_LUCENE_10_0_0 = def(9_000_0_00, Version.LUCENE_10_0_0);
139140
public static final IndexVersion LOGSDB_DEFAULT_IGNORE_DYNAMIC_BEYOND_LIMIT = def(9_001_0_00, Version.LUCENE_10_0_0);
140141
public static final IndexVersion TIME_BASED_K_ORDERED_DOC_ID = def(9_002_0_00, Version.LUCENE_10_0_0);

server/src/main/java/org/elasticsearch/index/mapper/KeywordFieldMapper.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ && hasDocValues()
447447
&& fieldtype.stored() == false
448448
&& copyTo.copyToFields().isEmpty()
449449
&& multiFieldsBuilder.hasMultiFields() == false
450-
&& indexCreatedVersion.onOrAfter(IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_KEYWORD)) {
450+
&& indexVersionSupportStoringArraysNatively()) {
451451
// Skip stored, we will be synthesizing from stored fields, no point to keep track of the offsets
452452
// Skip copy_to and multi fields, supporting that requires more work. However, copy_to usage is rare in metrics and
453453
// logging use cases
@@ -472,6 +472,14 @@ && hasDocValues()
472472
);
473473
}
474474

475+
private boolean indexVersionSupportStoringArraysNatively() {
476+
return indexCreatedVersion.onOrAfter(IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_KEYWORD)
477+
|| indexCreatedVersion.between(
478+
IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_KEYWORD_BACKPORT_8_X,
479+
IndexVersions.UPGRADE_TO_LUCENE_10_0_0
480+
);
481+
}
482+
475483
private FieldType resolveFieldType(
476484
final boolean useDocValuesSkipper,
477485
final IndexVersion indexCreatedVersion,

0 commit comments

Comments
 (0)