Skip to content

Commit 19df568

Browse files
committed
default index settings test
1 parent 0f7d6d3 commit 19df568

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ setup:
6161
type: hnsw
6262
m: 32
6363
ef_construction: 200
64+
early_termination: false
6465

6566
---
6667
"Not indexed vector":
@@ -89,6 +90,7 @@ setup:
8990
type: dense_vector
9091
dims: 5
9192
index: false
93+
early_termination: false
9294
---
9395
"Not indexed vector - vector similarity":
9496
- do:
@@ -147,6 +149,7 @@ setup:
147149
- match: { test_default_index_options.mappings.properties.vector.index: true }
148150
- match: { test_default_index_options.mappings.properties.vector.similarity: cosine }
149151
- match: { test_default_index_options.mappings.properties.vector.index_options.type: int8_hnsw }
152+
- match: { test_default_index_options.mappings.properties.vector.index_options.early_termination: false }
150153
---
151154
"Default index options for dense_vector element type byte":
152155
- requires:
@@ -174,3 +177,4 @@ setup:
174177
- match: { test_default_index_options.mappings.properties.vector.index: true }
175178
- match: { test_default_index_options.mappings.properties.vector.similarity: cosine }
176179
- is_false: test_default_index_options.mappings.properties.vector.index_options.type
180+
- match: { test_default_index_options.mappings.properties.vector.index_options.early_termination: false }

server/src/test/java/org/elasticsearch/index/mapper/vectors/DenseVectorFieldTypeTests.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -681,9 +681,12 @@ public void testRescoreOversampleQueryOverrides() {
681681

682682
public void testFilterSearchThreshold() {
683683
List<Tuple<DenseVectorFieldMapper.ElementType, Function<Query, KnnSearchStrategy>>> cases = List.of(
684-
Tuple.tuple(FLOAT, q -> ((ESKnnFloatVectorQuery) q).getStrategy()),
685-
Tuple.tuple(BYTE, q -> ((ESKnnByteVectorQuery) q).getStrategy()),
686-
Tuple.tuple(BIT, q -> ((ESKnnByteVectorQuery) q).getStrategy())
684+
Tuple.tuple(FLOAT, q -> q instanceof PatienceKnnVectorQuery patienceKnnVectorQuery ?
685+
patienceKnnVectorQuery.getSearchStrategy() : ((ESKnnFloatVectorQuery) q).getStrategy()),
686+
Tuple.tuple(BYTE, q -> q instanceof PatienceKnnVectorQuery patienceKnnVectorQuery ?
687+
patienceKnnVectorQuery.getSearchStrategy() : ((ESKnnByteVectorQuery) q).getStrategy()),
688+
Tuple.tuple(BIT, q -> q instanceof PatienceKnnVectorQuery patienceKnnVectorQuery ?
689+
patienceKnnVectorQuery.getSearchStrategy() : ((ESKnnByteVectorQuery) q).getStrategy())
687690
);
688691
for (var tuple : cases) {
689692
DenseVectorFieldType fieldType = new DenseVectorFieldType(

0 commit comments

Comments
 (0)