File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed
modules/mapper-extras/src/main/java/org/elasticsearch/index/mapper/extras
server/src/main/java/org/elasticsearch/index Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 33
33
import org .elasticsearch .common .lucene .Lucene ;
34
34
import org .elasticsearch .common .unit .Fuzziness ;
35
35
import org .elasticsearch .index .IndexVersion ;
36
- import org .elasticsearch .index .IndexVersions ;
37
36
import org .elasticsearch .index .analysis .IndexAnalyzers ;
38
37
import org .elasticsearch .index .analysis .NamedAnalyzer ;
39
38
import org .elasticsearch .index .fielddata .FieldDataContext ;
71
70
import java .util .Objects ;
72
71
import java .util .Set ;
73
72
73
+ import static org .elasticsearch .index .mapper .TextFieldMapper .Builder .multiFieldsNotStoredByDefaultIndexVersionCheck ;
74
+
74
75
/**
75
76
* A {@link FieldMapper} for full-text fields that only indexes
76
77
* {@link IndexOptions#DOCS} and runs positional queries by looking at the
@@ -140,7 +141,7 @@ private MatchOnlyTextFieldType buildFieldType(MapperBuilderContext context) {
140
141
public MatchOnlyTextFieldMapper build (MapperBuilderContext context ) {
141
142
MatchOnlyTextFieldType tft = buildFieldType (context );
142
143
final boolean storeSource ;
143
- if (indexCreatedVersion . onOrAfter ( IndexVersions . MAPPER_TEXT_MATCH_ONLY_MULTI_FIELDS_DEFAULT_NOT_STORED )) {
144
+ if (multiFieldsNotStoredByDefaultIndexVersionCheck ( indexCreatedVersion )) {
144
145
storeSource = context .isSourceSynthetic ()
145
146
&& withinMultiField == false
146
147
&& multiFieldsBuilder .hasSyntheticSourceCompatibleKeywordField () == false ;
Original file line number Diff line number Diff line change @@ -142,6 +142,7 @@ private static Version parseUnchecked(String version) {
142
142
public static final IndexVersion DEFAULT_OVERSAMPLE_VALUE_FOR_BBQ_BACKPORT_8_X = def (8_530_0_00 , Version .LUCENE_9_12_1 );
143
143
public static final IndexVersion SEMANTIC_TEXT_DEFAULTS_TO_BBQ_BACKPORT_8_X = def (8_531_0_00 , Version .LUCENE_9_12_1 );
144
144
public static final IndexVersion INDEX_INT_SORT_INT_TYPE_8_19 = def (8_532_0_00 , Version .LUCENE_9_12_1 );
145
+ public static final IndexVersion MAPPER_TEXT_MATCH_ONLY_MULTI_FIELDS_DEFAULT_NOT_STORED_8_19 = def (8_533_0_00 , Version .LUCENE_9_12_1 );
145
146
public static final IndexVersion UPGRADE_TO_LUCENE_10_0_0 = def (9_000_0_00 , Version .LUCENE_10_0_0 );
146
147
public static final IndexVersion LOGSDB_DEFAULT_IGNORE_DYNAMIC_BEYOND_LIMIT = def (9_001_0_00 , Version .LUCENE_10_0_0 );
147
148
public static final IndexVersion TIME_BASED_K_ORDERED_DOC_ID = def (9_002_0_00 , Version .LUCENE_10_0_0 );
Original file line number Diff line number Diff line change @@ -311,7 +311,7 @@ public Builder(
311
311
// Note that if current builder is a multi field, then we don't need to store, given that responsibility lies with parent field
312
312
this .withinMultiField = withinMultiField ;
313
313
this .store = Parameter .storeParam (m -> ((TextFieldMapper ) m ).store , () -> {
314
- if (indexCreatedVersion . onOrAfter ( IndexVersions . MAPPER_TEXT_MATCH_ONLY_MULTI_FIELDS_DEFAULT_NOT_STORED )) {
314
+ if (multiFieldsNotStoredByDefaultIndexVersionCheck ( indexCreatedVersion )) {
315
315
return isSyntheticSourceEnabled
316
316
&& this .withinMultiField == false
317
317
&& multiFieldsBuilder .hasSyntheticSourceCompatibleKeywordField () == false ;
@@ -329,6 +329,14 @@ public Builder(
329
329
this .isSyntheticSourceEnabled = isSyntheticSourceEnabled ;
330
330
}
331
331
332
+ public static boolean multiFieldsNotStoredByDefaultIndexVersionCheck (IndexVersion indexCreatedVersion ) {
333
+ return indexCreatedVersion .onOrAfter (IndexVersions .MAPPER_TEXT_MATCH_ONLY_MULTI_FIELDS_DEFAULT_NOT_STORED )
334
+ || indexCreatedVersion .between (
335
+ IndexVersions .MAPPER_TEXT_MATCH_ONLY_MULTI_FIELDS_DEFAULT_NOT_STORED_8_19 ,
336
+ IndexVersions .UPGRADE_TO_LUCENE_10_0_0
337
+ );
338
+ }
339
+
332
340
public Builder index (boolean index ) {
333
341
this .index .setValue (index );
334
342
return this ;
You can’t perform that action at this time.
0 commit comments