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 3333import org .elasticsearch .common .lucene .Lucene ;
3434import org .elasticsearch .common .unit .Fuzziness ;
3535import org .elasticsearch .index .IndexVersion ;
36- import org .elasticsearch .index .IndexVersions ;
3736import org .elasticsearch .index .analysis .IndexAnalyzers ;
3837import org .elasticsearch .index .analysis .NamedAnalyzer ;
3938import org .elasticsearch .index .fielddata .FieldDataContext ;
7170import java .util .Objects ;
7271import java .util .Set ;
7372
73+ import static org .elasticsearch .index .mapper .TextFieldMapper .Builder .multiFieldsNotStoredByDefaultIndexVersionCheck ;
74+
7475/**
7576 * A {@link FieldMapper} for full-text fields that only indexes
7677 * {@link IndexOptions#DOCS} and runs positional queries by looking at the
@@ -140,7 +141,7 @@ private MatchOnlyTextFieldType buildFieldType(MapperBuilderContext context) {
140141 public MatchOnlyTextFieldMapper build (MapperBuilderContext context ) {
141142 MatchOnlyTextFieldType tft = buildFieldType (context );
142143 final boolean storeSource ;
143- if (indexCreatedVersion . onOrAfter ( IndexVersions . MAPPER_TEXT_MATCH_ONLY_MULTI_FIELDS_DEFAULT_NOT_STORED )) {
144+ if (multiFieldsNotStoredByDefaultIndexVersionCheck ( indexCreatedVersion )) {
144145 storeSource = context .isSourceSynthetic ()
145146 && withinMultiField == false
146147 && multiFieldsBuilder .hasSyntheticSourceCompatibleKeywordField () == false ;
Original file line number Diff line number Diff line change @@ -142,6 +142,7 @@ private static Version parseUnchecked(String version) {
142142 public static final IndexVersion DEFAULT_OVERSAMPLE_VALUE_FOR_BBQ_BACKPORT_8_X = def (8_530_0_00 , Version .LUCENE_9_12_1 );
143143 public static final IndexVersion SEMANTIC_TEXT_DEFAULTS_TO_BBQ_BACKPORT_8_X = def (8_531_0_00 , Version .LUCENE_9_12_1 );
144144 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 );
145146 public static final IndexVersion UPGRADE_TO_LUCENE_10_0_0 = def (9_000_0_00 , Version .LUCENE_10_0_0 );
146147 public static final IndexVersion LOGSDB_DEFAULT_IGNORE_DYNAMIC_BEYOND_LIMIT = def (9_001_0_00 , Version .LUCENE_10_0_0 );
147148 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(
311311 // Note that if current builder is a multi field, then we don't need to store, given that responsibility lies with parent field
312312 this .withinMultiField = withinMultiField ;
313313 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 )) {
315315 return isSyntheticSourceEnabled
316316 && this .withinMultiField == false
317317 && multiFieldsBuilder .hasSyntheticSourceCompatibleKeywordField () == false ;
@@ -329,6 +329,14 @@ public Builder(
329329 this .isSyntheticSourceEnabled = isSyntheticSourceEnabled ;
330330 }
331331
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+
332340 public Builder index (boolean index ) {
333341 this .index .setValue (index );
334342 return this ;
You can’t perform that action at this time.
0 commit comments