Skip to content

Commit b530453

Browse files
committed
address index version support for main
1 parent 75de0d0 commit b530453

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
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
@@ -150,6 +150,7 @@ private static Version parseUnchecked(String version) {
150150
public static final IndexVersion TIMESTAMP_DOC_VALUES_SPARSE_INDEX = def(9_011_0_00, Version.LUCENE_10_1_0);
151151
public static final IndexVersion TIME_SERIES_ID_DOC_VALUES_SPARSE_INDEX = def(9_012_0_00, Version.LUCENE_10_1_0);
152152
public static final IndexVersion SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_KEYWORD = def(9_013_0_00, Version.LUCENE_10_1_0);
153+
public static final IndexVersion SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_IP = def(9_014_0_00, Version.LUCENE_10_1_0);
153154
/*
154155
* STOP! READ THIS FIRST! No, really,
155156
* ____ _____ ___ ____ _ ____ _____ _ ____ _____ _ _ ___ ____ _____ ___ ____ ____ _____ _

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ static String getOffsetsFieldName(
8787
Mapper.SourceKeepMode indexSourceKeepMode,
8888
boolean hasDocValues,
8989
boolean isStored,
90+
FieldMapper.Builder fieldMapperBuilder,
9091
IndexVersion indexCreatedVersion,
91-
FieldMapper.Builder fieldMapperBuilder
92+
IndexVersion minSupportedVersionMain
9293
) {
9394
var sourceKeepMode = fieldMapperBuilder.sourceKeepMode.orElse(indexSourceKeepMode);
9495
if (context.isSourceSynthetic()
@@ -97,7 +98,7 @@ static String getOffsetsFieldName(
9798
&& isStored == false
9899
&& fieldMapperBuilder.copyTo.copyToFields().isEmpty()
99100
&& fieldMapperBuilder.multiFieldsBuilder.hasMultiFields() == false
100-
&& indexVersionSupportStoringArraysNatively(indexCreatedVersion)) {
101+
&& indexVersionSupportStoringArraysNatively(indexCreatedVersion, minSupportedVersionMain)) {
101102
// Skip stored, we will be synthesizing from stored fields, no point to keep track of the offsets
102103
// Skip copy_to and multi fields, supporting that requires more work. However, copy_to usage is rare in metrics and
103104
// logging use cases
@@ -110,8 +111,11 @@ && indexVersionSupportStoringArraysNatively(indexCreatedVersion)) {
110111
}
111112
}
112113

113-
private static boolean indexVersionSupportStoringArraysNatively(IndexVersion indexCreatedVersion) {
114-
return indexCreatedVersion.onOrAfter(IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_KEYWORD)
114+
private static boolean indexVersionSupportStoringArraysNatively(
115+
IndexVersion indexCreatedVersion,
116+
IndexVersion minSupportedVersionMain
117+
) {
118+
return indexCreatedVersion.onOrAfter(minSupportedVersionMain)
115119
|| indexCreatedVersion.between(
116120
IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_KEYWORD_BACKPORT_8_X,
117121
IndexVersions.UPGRADE_TO_LUCENE_10_0_0

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,9 @@ public IpFieldMapper build(MapperBuilderContext context) {
199199
indexSourceKeepMode,
200200
hasDocValues.getValue(),
201201
stored.getValue(),
202+
this,
202203
indexCreatedVersion,
203-
this
204+
IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_IP
204205
);
205206
return new IpFieldMapper(
206207
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
@@ -444,8 +444,9 @@ public KeywordFieldMapper build(MapperBuilderContext context) {
444444
indexSourceKeepMode,
445445
hasDocValues.getValue(),
446446
stored.getValue(),
447+
this,
447448
indexCreatedVersion,
448-
this
449+
IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_KEYWORD
449450
);
450451
return new KeywordFieldMapper(
451452
leafName(),

0 commit comments

Comments
 (0)