Skip to content

Commit 589f657

Browse files
committed
Gate default BBQ by IndexVersion
1 parent 071a7bd commit 589f657

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
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
@@ -159,6 +159,7 @@ private static Version parseUnchecked(String version) {
159159
public static final IndexVersion SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_UNSIGNED_LONG = def(9_019_0_00, Version.LUCENE_10_1_0);
160160
public static final IndexVersion SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_SCALED_FLOAT = def(9_020_0_00, Version.LUCENE_10_1_0);
161161
public static final IndexVersion USE_LUCENE101_POSTINGS_FORMAT = def(9_021_0_00, Version.LUCENE_10_1_0);
162+
public static final IndexVersion SEMANTIC_TEXT_DEFAULTS_TO_BBQ = def(9_022_0_00, Version.LUCENE_10_1_0);
162163
/*
163164
* STOP! READ THIS FIRST! No, really,
164165
* ____ _____ ___ ____ _ ____ _____ _ ____ _____ _ _ ___ ____ _____ ___ ____ ____ _____ _

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/mapper/SemanticTextFieldMapper.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
import java.util.function.BiConsumer;
9393
import java.util.function.Function;
9494

95+
import static org.elasticsearch.index.IndexVersions.SEMANTIC_TEXT_DEFAULTS_TO_BBQ;
9596
import static org.elasticsearch.inference.TaskType.SPARSE_EMBEDDING;
9697
import static org.elasticsearch.inference.TaskType.TEXT_EMBEDDING;
9798
import static org.elasticsearch.search.SearchService.DEFAULT_SIZE;
@@ -1010,8 +1011,12 @@ private static Mapper.Builder createEmbeddingsField(
10101011
denseVectorMapperBuilder.dimensions(modelSettings.dimensions());
10111012
denseVectorMapperBuilder.elementType(modelSettings.elementType());
10121013

1013-
DenseVectorFieldMapper.IndexOptions defaultIndexOptions = defaultSemanticDenseIndexOptions();
1014-
if (defaultIndexOptions.validate(modelSettings.elementType(), modelSettings.dimensions(), false)) {
1014+
DenseVectorFieldMapper.IndexOptions defaultIndexOptions = null;
1015+
if (indexVersionCreated.onOrAfter(SEMANTIC_TEXT_DEFAULTS_TO_BBQ)) {
1016+
defaultIndexOptions = defaultSemanticDenseIndexOptions();
1017+
}
1018+
if (defaultIndexOptions != null
1019+
&& defaultIndexOptions.validate(modelSettings.elementType(), modelSettings.dimensions(), false)) {
10151020
denseVectorMapperBuilder.indexOptions(defaultIndexOptions);
10161021
}
10171022

0 commit comments

Comments
 (0)