Skip to content

Commit c78d8a5

Browse files
committed
Include 8.x backport version in index version checks for offset encoding
1 parent 50437e7 commit c78d8a5

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
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
@@ -136,6 +136,7 @@ private static Version parseUnchecked(String version) {
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"));
138138
public static final IndexVersion SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_KEYWORD_BACKPORT_8_X = def(8_527_0_00, Version.LUCENE_9_12_1);
139+
public static final IndexVersion SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_NUMBER_BACKPORT_8_X = def(8_528_0_00, Version.LUCENE_9_12_1);
139140
public static final IndexVersion UPGRADE_TO_LUCENE_10_0_0 = def(9_000_0_00, Version.LUCENE_10_0_0);
140141
public static final IndexVersion LOGSDB_DEFAULT_IGNORE_DYNAMIC_BEYOND_LIMIT = def(9_001_0_00, Version.LUCENE_10_0_0);
141142
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/FieldArrayContext.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ static String getOffsetsFieldName(
9090
boolean isStored,
9191
FieldMapper.Builder fieldMapperBuilder,
9292
IndexVersion indexCreatedVersion,
93-
IndexVersion minSupportedVersionMain
93+
IndexVersion minSupportedVersionMain,
94+
IndexVersion minSupportedVersion8x
9495
) {
9596
var sourceKeepMode = fieldMapperBuilder.sourceKeepMode.orElse(indexSourceKeepMode);
9697
if (context.isSourceSynthetic()
@@ -100,7 +101,7 @@ static String getOffsetsFieldName(
100101
&& context.isInNestedContext() == false
101102
&& fieldMapperBuilder.copyTo.copyToFields().isEmpty()
102103
&& fieldMapperBuilder.multiFieldsBuilder.hasMultiFields() == false
103-
&& indexVersionSupportStoringArraysNatively(indexCreatedVersion, minSupportedVersionMain)) {
104+
&& indexVersionSupportStoringArraysNatively(indexCreatedVersion, minSupportedVersionMain, minSupportedVersion8x)) {
104105
// Skip stored, we will be synthesizing from stored fields, no point to keep track of the offsets
105106
// Skip copy_to and multi fields, supporting that requires more work. However, copy_to usage is rare in metrics and
106107
// logging use cases
@@ -115,13 +116,11 @@ && indexVersionSupportStoringArraysNatively(indexCreatedVersion, minSupportedVer
115116

116117
private static boolean indexVersionSupportStoringArraysNatively(
117118
IndexVersion indexCreatedVersion,
118-
IndexVersion minSupportedVersionMain
119+
IndexVersion minSupportedVersionMain,
120+
IndexVersion minSupportedVersion8x
119121
) {
120122
return indexCreatedVersion.onOrAfter(minSupportedVersionMain)
121-
|| indexCreatedVersion.between(
122-
IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_KEYWORD_BACKPORT_8_X,
123-
IndexVersions.UPGRADE_TO_LUCENE_10_0_0
124-
);
123+
|| indexCreatedVersion.between(minSupportedVersion8x, IndexVersions.UPGRADE_TO_LUCENE_10_0_0);
125124
}
126125

127126
private static class Offsets {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ public IpFieldMapper build(MapperBuilderContext context) {
201201
stored.getValue(),
202202
this,
203203
indexCreatedVersion,
204-
IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_IP
204+
IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_IP,
205+
IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_KEYWORD_BACKPORT_8_X
205206
);
206207
return new IpFieldMapper(
207208
leafName(),

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,8 @@ public KeywordFieldMapper build(MapperBuilderContext context) {
446446
stored.getValue(),
447447
this,
448448
indexCreatedVersion,
449-
IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_KEYWORD
449+
IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_KEYWORD,
450+
IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_KEYWORD_BACKPORT_8_X
450451
);
451452
return new KeywordFieldMapper(
452453
leafName(),

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,8 @@ public NumberFieldMapper build(MapperBuilderContext context) {
297297
stored.getValue(),
298298
this,
299299
indexCreatedVersion,
300-
IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_NUMBER
300+
IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_NUMBER,
301+
IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_NUMBER_BACKPORT_8_X
301302
);
302303
return new NumberFieldMapper(leafName(), ft, builderParams(this, context), context.isSourceSynthetic(), this, offsetsFieldName);
303304
}

0 commit comments

Comments
 (0)