Skip to content

Commit 483960f

Browse files
committed
rest compatibility check with search features
1 parent 6b70605 commit 483960f

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search.vectors/80_dense_vector_indexed_by_default.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,43 @@ setup:
2525
- match: { test.mappings.properties.vector.dims: 5 }
2626
- match: { test.mappings.properties.vector.index: true }
2727
- match: { test.mappings.properties.vector.similarity: cosine }
28+
29+
---
30+
"Indexed by default with specified similarity and index options":
31+
- do:
32+
indices.create:
33+
index: test
34+
body:
35+
mappings:
36+
properties:
37+
vector:
38+
type: dense_vector
39+
dims: 5
40+
similarity: dot_product
41+
index_options:
42+
type: hnsw
43+
m: 32
44+
ef_construction: 200
45+
46+
- match: { acknowledged: true }
47+
48+
- do:
49+
indices.get_mapping:
50+
index: test
51+
52+
- match: { test.mappings.properties.vector.type: dense_vector }
53+
- match: { test.mappings.properties.vector.dims: 5 }
54+
- match: { test.mappings.properties.vector.index: true }
55+
- match: { test.mappings.properties.vector.similarity: dot_product }
56+
- match: { test.mappings.properties.vector.index_options.type: hnsw }
57+
- match: { test.mappings.properties.vector.index_options.m: 32 }
58+
- match: { test.mappings.properties.vector.index_options.ef_construction: 200 }
59+
- match: { test.mappings.properties.vector.index_options.early_termination: null }
60+
2861
---
2962
"Indexed by default with specified similarity and index options":
63+
- cluster_features: [ "search.vectors.mappers.expose_hnsw_early_termination" ]
64+
- reason: "requires early termination for hnsw to be exposed"
3065
- do:
3166
indices.create:
3267
index: test
@@ -55,6 +90,7 @@ setup:
5590
- match: { test.mappings.properties.vector.index_options.type: hnsw }
5691
- match: { test.mappings.properties.vector.index_options.m: 32 }
5792
- match: { test.mappings.properties.vector.index_options.ef_construction: 200 }
93+
- match: { test.mappings.properties.vector.index_options.early_termination: false }
5894

5995
---
6096
"Not indexed vector":

server/src/main/java/org/elasticsearch/search/SearchFeatures.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public Set<NodeFeature> getFeatures() {
3232
public static final NodeFeature INT_SORT_FOR_INT_SHORT_BYTE_FIELDS = new NodeFeature("search.sort.int_sort_for_int_short_byte_fields");
3333
static final NodeFeature MULTI_MATCH_CHECKS_POSITIONS = new NodeFeature("search.multi.match.checks.positions");
3434
public static final NodeFeature BBQ_HNSW_DEFAULT_INDEXING = new NodeFeature("search.vectors.mappers.default_bbq_hnsw");
35+
public static final NodeFeature EXPOSE_HNSW_EARLY_TERMINATION = new NodeFeature("search.vectors.mappers.expose_hnsw_early_termination");
3536

3637
@Override
3738
public Set<NodeFeature> getTestFeatures() {
@@ -41,7 +42,8 @@ public Set<NodeFeature> getTestFeatures() {
4142
RESCORER_MISSING_FIELD_BAD_REQUEST,
4243
INT_SORT_FOR_INT_SHORT_BYTE_FIELDS,
4344
MULTI_MATCH_CHECKS_POSITIONS,
44-
BBQ_HNSW_DEFAULT_INDEXING
45+
BBQ_HNSW_DEFAULT_INDEXING,
46+
EXPOSE_HNSW_EARLY_TERMINATION
4547
);
4648
}
4749
}

0 commit comments

Comments
 (0)