Skip to content

Commit 197bb58

Browse files
committed
yaml test fix
1 parent 5b5c997 commit 197bb58

File tree

1 file changed

+35
-33
lines changed

1 file changed

+35
-33
lines changed

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search.vectors/240_knn_search_early_termination.yml

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ setup:
1515
type: dense_vector
1616
dims: 64
1717
index: true
18-
similarity: dot_product
18+
similarity: max_inner_product
1919
index_options:
2020
type: bbq_hnsw
2121
early_termination: true
@@ -88,36 +88,37 @@ setup:
8888
-0.224, 0.203, -0.439, 0.064, 0.246, -0.396, 0.297, 0.242,
8989
-0.028, 0.321, -0.022, -0.009, -0.001 , 0.031, -0.533, 0.45,
9090
-0.683, 1.331, 0.194, -0.157, -0.1 , -0.279, -0.098, -0.789 ]
91-
# Flush in order to provoke a merge later
9291
- do:
9392
indices.flush:
9493
index: bbq_hnsw
9594

95+
- do:
96+
indices.refresh: {}
97+
9698
---
9799
"Run knn search with early termination":
98100

99101
- do:
100102
search:
101103
index: bbq_hnsw
102104
body:
103-
profile: true
104-
knn:
105-
field: vector
106-
query_vector: [0.128, 0.067, -0.08 , 0.395, -0.11 , -0.259, 0.473, -0.393,
107-
0.292, 0.571, -0.491, 0.444, -0.288, 0.198, -0.343, 0.015,
108-
0.232, 0.088, 0.228, 0.151, -0.136, 0.236, -0.273, -0.259,
109-
-0.217, 0.359, -0.207, 0.352, -0.142, 0.192, -0.061, -0.17 ,
110-
-0.343, 0.189, -0.221, 0.32 , -0.301, -0.1 , 0.005, 0.232,
111-
-0.344, 0.136, 0.252, 0.157, -0.13 , -0.244, 0.193, -0.034,
112-
-0.12 , -0.193, -0.102, 0.252, -0.185, -0.167, -0.575, 0.582,
113-
-0.426, 0.983, 0.212, 0.204, 0.03 , -0.276, -0.425, -0.158]
114-
k: 3
115-
num_candidates: 3
105+
query:
106+
knn:
107+
field: vector
108+
query_vector: [0.128, 0.067, -0.08 , 0.395, -0.11 , -0.259, 0.473, -0.393,
109+
0.292, 0.571, -0.491, 0.444, -0.288, 0.198, -0.343, 0.015,
110+
0.232, 0.088, 0.228, 0.151, -0.136, 0.236, -0.273, -0.259,
111+
-0.217, 0.359, -0.207, 0.352, -0.142, 0.192, -0.061, -0.17 ,
112+
-0.343, 0.189, -0.221, 0.32 , -0.301, -0.1 , 0.005, 0.232,
113+
-0.344, 0.136, 0.252, 0.157, -0.13 , -0.244, 0.193, -0.034,
114+
-0.12 , -0.193, -0.102, 0.252, -0.185, -0.167, -0.575, 0.582,
115+
-0.426, 0.983, 0.212, 0.204, 0.03 , -0.276, -0.425, -0.158]
116+
num_candidates: 5
117+
k: 3
116118

117-
- match: { hits.total.value: 5 } # collector sees k docs
118-
- length: { hits.hits: 3 } # size docs retrieved
119-
- match: { hits.hits.0._id: "1" }
120-
- match: { hits.hits.1._id: "2" }
119+
- match: { hits.total.value: 3 }
120+
- match: { hits.hits.0._id: "5" }
121+
- match: { hits.hits.1._id: "1" }
121122
- match: { hits.hits.2._id: "3" }
122123

123124
---
@@ -128,20 +129,21 @@ setup:
128129
index: bbq_hnsw
129130
body:
130131
profile: true
131-
knn:
132-
field: vector
133-
query_vector: [0.128, 0.067, -0.08 , 0.395, -0.11 , -0.259, 0.473, -0.393,
134-
0.292, 0.571, -0.491, 0.444, -0.288, 0.198, -0.343, 0.015,
135-
0.232, 0.088, 0.228, 0.151, -0.136, 0.236, -0.273, -0.259,
136-
-0.217, 0.359, -0.207, 0.352, -0.142, 0.192, -0.061, -0.17 ,
137-
-0.343, 0.189, -0.221, 0.32 , -0.301, -0.1 , 0.005, 0.232,
138-
-0.344, 0.136, 0.252, 0.157, -0.13 , -0.244, 0.193, -0.034,
139-
-0.12 , -0.193, -0.102, 0.252, -0.185, -0.167, -0.575, 0.582,
140-
-0.426, 0.983, 0.212, 0.204, 0.03 , -0.276, -0.425, -0.158]
141-
k: 3
142-
num_candidates: 3
132+
query:
133+
knn:
134+
field: vector
135+
query_vector: [0.128, 0.067, -0.08 , 0.395, -0.11 , -0.259, 0.473, -0.393,
136+
0.292, 0.571, -0.491, 0.444, -0.288, 0.198, -0.343, 0.015,
137+
0.232, 0.088, 0.228, 0.151, -0.136, 0.236, -0.273, -0.259,
138+
-0.217, 0.359, -0.207, 0.352, -0.142, 0.192, -0.061, -0.17 ,
139+
-0.343, 0.189, -0.221, 0.32 , -0.301, -0.1 , 0.005, 0.232,
140+
-0.344, 0.136, 0.252, 0.157, -0.13 , -0.244, 0.193, -0.034,
141+
-0.12 , -0.193, -0.102, 0.252, -0.185, -0.167, -0.575, 0.582,
142+
-0.426, 0.983, 0.212, 0.204, 0.03 , -0.276, -0.425, -0.158]
143+
k: 3
144+
num_candidates: 3
143145

144-
- match: { profile.shards.0.dfs.knn.0.vector_operations_count: 6 }
146+
- match: { profile.shards.0.dfs.knn.0.vector_operations_count: null }
145147

146148
# Search with similarity to check number of operations are propagated correctly
147149
- do:
@@ -163,4 +165,4 @@ setup:
163165
num_candidates: 3
164166
similarity: 100000
165167

166-
- match: { profile.shards.0.dfs.knn.0.vector_operations_count: 6 }
168+
- match: { profile.shards.0.dfs.knn.0.vector_operations_count: 5 }

0 commit comments

Comments
 (0)