Skip to content

Commit d374838

Browse files
committed
Use feature flag more
1 parent 7b92450 commit d374838

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

server/src/main/java/org/elasticsearch/index/mapper/vectors/DenseVectorFieldMapper.java

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,7 @@ public static class Builder extends FieldMapper.Builder {
242242

243243
private final Parameter<ElementType> elementType = new Parameter<>("element_type", false, () -> ElementType.FLOAT, (n, c, o) -> {
244244
ElementType elementType = namesToElementType.get((String) o);
245-
if (elementType == null
246-
|| (elementType == ElementType.BFLOAT16 && ES93GenericFlatVectorsFormat.GENERIC_VECTOR_FORMAT.isEnabled() == false)) {
245+
if (elementType == null) {
247246
throw new MapperParsingException("invalid element_type [" + o + "]; available types are " + namesToElementType.keySet());
248247
}
249248
return elementType;
@@ -485,16 +484,25 @@ public String toString() {
485484
public static final Element BFLOAT16_ELEMENT = new BFloat16Element();
486485
public static final Element BIT_ELEMENT = new BitElement();
487486

488-
public static final Map<String, ElementType> namesToElementType = Map.of(
489-
ElementType.BYTE.toString(),
490-
ElementType.BYTE,
491-
ElementType.FLOAT.toString(),
492-
ElementType.FLOAT,
493-
ElementType.BFLOAT16.toString(),
494-
ElementType.BFLOAT16,
495-
ElementType.BIT.toString(),
496-
ElementType.BIT
497-
);
487+
public static final Map<String, ElementType> namesToElementType = ES93GenericFlatVectorsFormat.GENERIC_VECTOR_FORMAT.isEnabled()
488+
? Map.of(
489+
ElementType.BYTE.toString(),
490+
ElementType.BYTE,
491+
ElementType.FLOAT.toString(),
492+
ElementType.FLOAT,
493+
ElementType.BFLOAT16.toString(),
494+
ElementType.BFLOAT16,
495+
ElementType.BIT.toString(),
496+
ElementType.BIT
497+
)
498+
: Map.of(
499+
ElementType.BYTE.toString(),
500+
ElementType.BYTE,
501+
ElementType.FLOAT.toString(),
502+
ElementType.FLOAT,
503+
ElementType.BIT.toString(),
504+
ElementType.BIT
505+
);
498506

499507
public abstract static class Element {
500508

x-pack/qa/core-rest-tests-with-security/src/yamlRestTest/java/org/elasticsearch/xpack/security/CoreWithSecurityClientYamlTestSuiteIT.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public class CoreWithSecurityClientYamlTestSuiteIT extends ESClientYamlSuiteTest
5252
.feature(FeatureFlag.DOC_VALUES_SKIPPER)
5353
.feature(FeatureFlag.SYNTHETIC_VECTORS)
5454
.feature(FeatureFlag.RANDOM_SAMPLING)
55+
.feature(FeatureFlag.GENERIC_VECTOR_FORMAT)
5556
.build();
5657

5758
public CoreWithSecurityClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {

0 commit comments

Comments
 (0)