Skip to content
Merged
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
9147de6
pulled new optional param visit_percentage through the query logic
john-wagster Aug 28, 2025
2ab8989
spotless
john-wagster Aug 28, 2025
f7b2927
Merge branch 'main' into query_visit_percentage
john-wagster Aug 28, 2025
e947aed
iter
john-wagster Aug 28, 2025
515ec99
Merge branch 'query_visit_percentage' of github.com:john-wagster/elas…
john-wagster Aug 28, 2025
ade061f
Merge branch 'main' into query_visit_percentage
john-wagster Aug 28, 2025
08d4e45
[CI] Auto commit changes from spotless
Aug 28, 2025
dc749b3
docs
john-wagster Aug 28, 2025
3a55ff2
Merge branch 'query_visit_percentage' of github.com:john-wagster/elas…
john-wagster Aug 28, 2025
af20b61
[CI] Auto commit changes from spotless
Aug 28, 2025
e02367b
docs
john-wagster Aug 29, 2025
da98068
Merge branch 'query_visit_percentage' of github.com:john-wagster/elas…
john-wagster Aug 29, 2025
e282003
iter
john-wagster Aug 29, 2025
98848b9
iter
john-wagster Aug 29, 2025
43f161f
iter
john-wagster Aug 29, 2025
7c304df
[CI] Auto commit changes from spotless
Aug 29, 2025
f305de5
iter
john-wagster Aug 29, 2025
c133b59
Merge branch 'main' into query_visit_percentage
john-wagster Aug 29, 2025
b412173
iter
john-wagster Aug 29, 2025
7144266
Merge branch 'query_visit_percentage' of github.com:john-wagster/elas…
john-wagster Aug 29, 2025
1b18b92
Merge branch 'main' into query_visit_percentage
john-wagster Aug 29, 2025
65af05a
iter
john-wagster Aug 30, 2025
12f8ae6
Merge branch 'main' into query_visit_percentage
john-wagster Aug 30, 2025
8c3b9c3
Merge branch 'main' into query_visit_percentage
john-wagster Aug 31, 2025
8f373ce
iter
john-wagster Aug 31, 2025
c1c3797
Merge branch 'main' into query_visit_percentage
john-wagster Aug 31, 2025
2d64cb1
Merge branch 'query_visit_percentage' of github.com:john-wagster/elas…
john-wagster Aug 31, 2025
1af3fe5
iter
john-wagster Aug 31, 2025
3df33c3
iter
john-wagster Aug 31, 2025
7bc1890
Merge branch 'main' into query_visit_percentage
john-wagster Aug 31, 2025
0b63778
cleanup
john-wagster Sep 1, 2025
056d914
added ivf_format feature flag
john-wagster Sep 1, 2025
65389c8
Merge branch 'main' into query_visit_percentage
john-wagster Sep 1, 2025
521d119
added some yaml tests only as parsing validation
john-wagster Sep 1, 2025
28ebb7e
merge
john-wagster Sep 1, 2025
e0cb9c5
Merge branch 'main' into query_visit_percentage
john-wagster Sep 1, 2025
76b74fe
Merge branch 'main' into query_visit_percentage
john-wagster Sep 2, 2025
341d491
fix transport versions
john-wagster Sep 2, 2025
7006315
add feature flag check
john-wagster Sep 2, 2025
5332d68
Update docs/changelog/133753.yaml
john-wagster Sep 2, 2025
ae3e566
Update docs/reference/query-languages/query-dsl/query-dsl-knn-query.md
john-wagster Sep 2, 2025
6ea6c59
consistent docs with fix to reference the range starting at 0
john-wagster Sep 2, 2025
71e0c43
removed unnecessary ctor and made visitPercentage a Float intead of a…
john-wagster Sep 2, 2025
bf8c01d
[CI] Auto commit changes from spotless
Sep 2, 2025
e68e3ce
merge w main TransportVersion fixes
john-wagster Sep 2, 2025
2690ce8
Merge branch 'query_visit_percentage' of github.com:john-wagster/elas…
john-wagster Sep 2, 2025
99f7c65
pass Float down through KnnSearchBuilder as null
john-wagster Sep 2, 2025
674466c
fix bad serialization
john-wagster Sep 3, 2025
b22e241
Merge branch 'main' into query_visit_percentage
john-wagster Sep 3, 2025
575ddcb
merge
john-wagster Sep 3, 2025
36c0a3e
Merge branch 'query_visit_percentage' of github.com:john-wagster/elas…
john-wagster Sep 3, 2025
454982e
Delete docs/changelog/133753.yaml
john-wagster Sep 3, 2025
6c24dd5
fixing nulls
john-wagster Sep 3, 2025
b1c78e1
Merge branch 'main' into query_visit_percentage
john-wagster Sep 3, 2025
6fb1c2f
Merge branch 'main' into query_visit_percentage
john-wagster Sep 3, 2025
78a0ecb
Merge branch 'query_visit_percentage' of github.com:john-wagster/elas…
john-wagster Sep 3, 2025
3f20296
improving tests with null checks and added diskbbq format to densevec…
john-wagster Sep 3, 2025
d2ac7c7
Merge branch 'main' into query_visit_percentage
john-wagster Sep 3, 2025
84aeeeb
spotless
john-wagster Sep 3, 2025
c70e728
Merge branch 'main' into query_visit_percentage
john-wagster Sep 3, 2025
52ae456
removed docs changes to a separate PR
john-wagster Sep 3, 2025
768facc
Merge branch 'query_visit_percentage' of github.com:john-wagster/elas…
john-wagster Sep 3, 2025
c7f1a4f
merge
john-wagster Sep 3, 2025
cd47e8c
missed a couple Floats
john-wagster Sep 3, 2025
bd5268f
Merge branch 'main' into query_visit_percentage
john-wagster Sep 3, 2025
16c9dbc
properly gate the parser ctors with the feature flag, and fix tests
john-wagster Sep 4, 2025
180f149
merge
john-wagster Sep 4, 2025
ff2164e
merge
john-wagster Sep 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions docs/reference/elasticsearch/mapping-reference/dense-vector.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,18 +341,19 @@ $$$dense-vector-index-options$$$
`type`
: (Required, string) The type of kNN algorithm to use. Can be either any of:
* `hnsw` - This utilizes the [HNSW algorithm](https://arxiv.org/abs/1603.09320) for scalable approximate kNN search. This supports all `element_type` values.
* `int8_hnsw` - The default index type for some float vectors:
* `int8_hnsw` - The default index type for some float vectors:
* {applies_to}`stack: ga 9.1` Default for float vectors with less than 384 dimensions.
* {applies_to}`stack: ga 9.0` Default for float all vectors.
This utilizes the [HNSW algorithm](https://arxiv.org/abs/1603.09320) in addition to automatically scalar quantization for scalable approximate kNN search with `element_type` of `float`. This can reduce the memory footprint by 4x at the cost of some accuracy. See [Automatically quantize vectors for kNN search](#dense-vector-quantization).
* `int4_hnsw` - This utilizes the [HNSW algorithm](https://arxiv.org/abs/1603.09320) in addition to automatically scalar quantization for scalable approximate kNN search with `element_type` of `float`. This can reduce the memory footprint by 8x at the cost of some accuracy. See [Automatically quantize vectors for kNN search](#dense-vector-quantization).
* `bbq_hnsw` - This utilizes the [HNSW algorithm](https://arxiv.org/abs/1603.09320) in addition to automatically binary quantization for scalable approximate kNN search with `element_type` of `float`. This can reduce the memory footprint by 32x at the cost of accuracy. See [Automatically quantize vectors for kNN search](#dense-vector-quantization).

{applies_to}`stack: ga 9.1` `bbq_hnsw` is the default index type for float vectors with greater than or equal to 384 dimensions.
* `flat` - This utilizes a brute-force search algorithm for exact kNN search. This supports all `element_type` values.
* `int8_flat` - This utilizes a brute-force search algorithm in addition to automatically scalar quantization. Only supports `element_type` of `float`.
* `int4_flat` - This utilizes a brute-force search algorithm in addition to automatically half-byte scalar quantization. Only supports `element_type` of `float`.
* `bbq_flat` - This utilizes a brute-force search algorithm in addition to automatically binary quantization. Only supports `element_type` of `float`.
* `int8_flat` - This utilizes a brute-force search algorithm in addition to automatic scalar quantization. Only supports `element_type` of `float`.
* `int4_flat` - This utilizes a brute-force search algorithm in addition to automatic half-byte scalar quantization. Only supports `element_type` of `float`.
* `bbq_flat` - This utilizes a brute-force search algorithm in addition to automatic binary quantization. Only supports `element_type` of `float`.
* {applies_to}`stack: ga 9.2` `bbq_disk` - This utilizes a clustering search algorithm in addition to automatic binary quantization. Only supports `element_type` of `float`.

`m`
: (Optional, integer) The number of neighbors each node will be connected to in the HNSW graph. Defaults to `16`. Only applicable to `hnsw`, `int8_hnsw`, `int4_hnsw` and `bbq_hnsw` index types.
Expand All @@ -363,6 +364,12 @@ $$$dense-vector-index-options$$$
`confidence_interval`
: (Optional, float) Only applicable to `int8_hnsw`, `int4_hnsw`, `int8_flat`, and `int4_flat` index types. The confidence interval to use when quantizing the vectors. Can be any value between and including `0.90` and `1.0` or exactly `0`. When the value is `0`, this indicates that dynamic quantiles should be calculated for optimized quantization. When between `0.90` and `1.0`, this value restricts the values used when calculating the quantization thresholds. For example, a value of `0.95` will only use the middle 95% of the values when calculating the quantization thresholds (e.g. the highest and lowest 2.5% of values will be ignored). Defaults to `1/(dims + 1)` for `int8` quantized vectors and `0` for `int4` for dynamic quantile calculation.

`default_visit_percentage` {applies_to}`stack: ga 9.2`
: (Optional, integer) Only applicable to `bbq_disk`. Must be between 0 and 100. 0 will default to using `num_candidates` for calculating the percent visited. Increasing `default_visit_percentage` tends to improve the accuracy of the final results. Defaults to ~1% per shard for every 1 million vectors.

`cluster_size` {applies_to}`stack: ga 9.2`
: (Optional, integer) Only applicable to `bbq_disk`. The number of vectors per cluster. Smaller cluster sizes increases accuracy at the cost of performance. Defaults to `384`. Must be a value between `64` and `65536`.

`rescore_vector` {applies_to}`stack: preview 9.0, ga 9.1`
: (Optional, object) An optional section that configures automatic vector rescoring on knn queries for the given field. Only applicable to quantized index types.
:::::{dropdown} Properties of rescore_vector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ A kNN retriever returns top documents from a [k-nearest neighbor search (kNN)](d
The number of nearest neighbor candidates to consider per shard. Needs to be greater than `k`, or `size` if `k` is omitted, and cannot exceed 10,000. {{es}} collects `num_candidates` results from each shard, then merges them to find the top `k` results. Increasing `num_candidates` tends to improve the accuracy of the final `k` results. Defaults to `Math.min(1.5 * k, 10_000)`.


```{applies_to}
stack: ga 9.2
```
`visit_percentage`
: (Optional, float)

The percentage of vectors to explore per shard while doing knn search with `bbq_disk`. Must be between 0 and 100. 0 will default to using `num_candidates` for calculating the percent visited. Increasing `visit_percentage` tends to improve the accuracy of the final results. If `visit_percentage` is set for `bbq_disk`, `num_candidates` is ignored. Defaults to ~1% per shard for every 1 million vectors.


`filter`
: (Optional, [query object or list of query objects](/reference/query-languages/querydsl.md))

Expand Down
14 changes: 12 additions & 2 deletions docs/reference/query-languages/query-dsl/query-dsl-knn-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
navigation_title: "Knn"
mapped_pages:
- https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-knn-query.html
applies_to:
stack: all
serverless: all
---

# Knn query [query-dsl-knn-query]
Expand Down Expand Up @@ -87,6 +90,13 @@ If all queried fields are of type [semantic_text](/reference/elasticsearch/mappi
: (Optional, integer) The number of nearest neighbor candidates to consider per shard while doing knn search. Cannot exceed 10,000. Increasing `num_candidates` tends to improve the accuracy of the final results. Defaults to `1.5 * k` if `k` is set, or `1.5 * size` if `k` is not set.


```{applies_to}
stack: ga 9.2
```
`visit_percentage`
: (Optional, float) The percentage of vectors to explore per shard while doing knn search with `bbq_disk`. Must be between 0 and 100. 0 will default to using `num_candidates` for calculating the percent visited. Increasing `visit_percentage` tends to improve the accuracy of the final results. If `visit_percentage` is set for `bbq_disk`, `num_candidates` is ignored. Defaults to ~1% per shard for every 1 million vectors.


`filter`
: (Optional, query object) Query to filter the documents that can match. The kNN search will return the top documents that also match this filter. The value can be a single query or a list of queries. If `filter` is not provided, all documents are allowed to match.

Expand All @@ -108,15 +118,15 @@ The filter is a pre-filter, meaning that it is applied **during** the approximat
: (Optional, object) Apply oversampling and rescoring to quantized vectors.

**Parameters for `rescore_vector`**:

`oversample`
: (Required, float)

Applies the specified oversample factor to `k` on the approximate kNN search. The approximate kNN search will:

* Retrieve `num_candidates` candidates per shard.
* From these candidates, the top `k * oversample` candidates per shard will be rescored using the original vectors.
* The top `k` rescored candidates will be returned. Must be one of the following values:
* The top `k` rescored candidates will be returned. Must be one of the following values:
* \>= 1f to indicate the oversample factor
* Exactly `0` to indicate that no oversampling and rescoring should occur. {applies_to}`stack: ga 9.1`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1359,7 +1359,7 @@ public void testKnnQueryNotSupportedInPercolator() throws IOException {
""");
indicesAdmin().prepareCreate("index1").setMapping(mappings).get();
ensureGreen();
QueryBuilder knnVectorQueryBuilder = new KnnVectorQueryBuilder("my_vector", new float[] { 1, 1, 1, 1, 1 }, 10, 10, null, null);
QueryBuilder knnVectorQueryBuilder = new KnnVectorQueryBuilder("my_vector", new float[] { 1, 1, 1, 1, 1 }, 10, 10, 10f, null, null);

IndexRequestBuilder indexRequestBuilder = prepareIndex("index1").setId("knn_query1")
.setSource(jsonBuilder().startObject().field("my_query", knnVectorQueryBuilder).endObject());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,30 @@ setup:
- match: {hits.hits.1._id: "3"}
- match: {hits.hits.1.fields.name.0: "rabbit.jpg"}

---
"kNN retrieve with visit_percentage":
- requires:
cluster_features: "mapper.bbq_disk_support"
reason: 'bbq disk support required'
- do:
search:
index: index1
body:
fields: [ "name" ]
retriever:
knn:
field: vector
query_vector: [2, 2, 2, 2, 3]
k: 2
num_candidates: 3
visit_percentage: 1.0

- match: {hits.hits.0._id: "2"}
- match: {hits.hits.0.fields.name.0: "moose.jpg"}

- match: {hits.hits.1._id: "3"}
- match: {hits.hits.1.fields.name.0: "rabbit.jpg"}

---
"kNN retriever with filter":
- do:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,27 @@ setup:
- match: {hits.hits.0._id: "3"}
- match: {hits.hits.0.fields.name.0: "rabbit.jpg"}
- match: { hits.hits.0.inner_hits.nested.hits.hits.0.fields.nested.0.paragraph_id.0: "0" }

---
"nested kNN search works with visit_percentage":
- do:
search:
index: test
body:
fields: [ "name" ]
query:
nested:
path: nested
query:
knn:
field: nested.vector
query_vector: [-0.5, 90, -10, 14.8, -156]
num_candidates: 3
visit_percentage: 1.0
- match: {hits.total.value: 3}

- match: {hits.hits.0._id: "2"}
- match: {hits.hits.0.fields.name.0: "moose.jpg"}

- match: {hits.hits.1._id: "3"}
- match: {hits.hits.1.fields.name.0: "rabbit.jpg"}
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,28 @@ setup:
- match: { hits.hits.1._id: "3" }
- match: { hits.hits.2._id: "2" }
---
"Test knn search with visit_percentage":
- do:
search:
index: bbq_disk
body:
knn:
field: vector
query_vector: [0.128, 0.067, -0.08 , 0.395, -0.11 , -0.259, 0.473, -0.393,
0.292, 0.571, -0.491, 0.444, -0.288, 0.198, -0.343, 0.015,
0.232, 0.088, 0.228, 0.151, -0.136, 0.236, -0.273, -0.259,
-0.217, 0.359, -0.207, 0.352, -0.142, 0.192, -0.061, -0.17 ,
-0.343, 0.189, -0.221, 0.32 , -0.301, -0.1 , 0.005, 0.232,
-0.344, 0.136, 0.252, 0.157, -0.13 , -0.244, 0.193, -0.034,
-0.12 , -0.193, -0.102, 0.252, -0.185, -0.167, -0.575, 0.582,
-0.426, 0.983, 0.212, 0.204, 0.03 , -0.276, -0.425, -0.158]
k: 3
visit_percentage: 1.0

- match: { hits.hits.0._id: "1" }
- match: { hits.hits.1._id: "3" }
- match: { hits.hits.2._id: "2" }
---
"Vector rescoring has same scoring as exact search for kNN section":
- skip:
features: "headers"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public void testDenseVectorMappingUpdate() throws Exception {
for (int i = 0; i < queryVector.length; i++) {
queryVector[i] = randomFloatBetween(-1, 1, true);
}
KnnVectorQueryBuilder queryBuilder = new KnnVectorQueryBuilder(VECTOR_FIELD, queryVector, null, null, null, null);
KnnVectorQueryBuilder queryBuilder = new KnnVectorQueryBuilder(VECTOR_FIELD, queryVector, null, null, null, null, null);
assertNoFailuresAndResponse(
client().prepareSearch(INDEX_NAME).setQuery(queryBuilder).setTrackTotalHits(true).setSize(expectedDocs),
response -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public void testDirectIOUsed() {
indexVectors();

// do a search
var knn = List.of(new KnnSearchBuilder("fooVector", new VectorData(null, new byte[64]), 10, 20, null, null));
var knn = List.of(new KnnSearchBuilder("fooVector", new VectorData(null, new byte[64]), 10, 20, 10f, null, null));
assertHitCount(prepareSearch("foo-vectors").setKnnSearch(knn), 10);
mockLog.assertAllExpectationsMatched();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,29 +77,29 @@ public void testKnnSearchWithScroll() throws Exception {
// test top level knn search
{
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
sourceBuilder.knnSearch(List.of(new KnnSearchBuilder(VECTOR_FIELD, new float[] { 0, 0 }, k, 100, null, null)));
sourceBuilder.knnSearch(List.of(new KnnSearchBuilder(VECTOR_FIELD, new float[] { 0, 0 }, k, 100, 10f, null, null)));
executeScrollSearch(client, sourceBuilder, k);
}
// test top level knn search + another query
{
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
sourceBuilder.knnSearch(List.of(new KnnSearchBuilder(VECTOR_FIELD, new float[] { 0, 0 }, k, 100, null, null)));
sourceBuilder.knnSearch(List.of(new KnnSearchBuilder(VECTOR_FIELD, new float[] { 0, 0 }, k, 100, 10f, null, null)));
sourceBuilder.query(QueryBuilders.existsQuery("category").boost(10));
executeScrollSearch(client, sourceBuilder, k + 10);
}

// test knn query
{
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
sourceBuilder.query(new KnnVectorQueryBuilder(VECTOR_FIELD, new float[] { 0, 0 }, k, 100, null, null));
sourceBuilder.query(new KnnVectorQueryBuilder(VECTOR_FIELD, new float[] { 0, 0 }, k, 100, 10f, null, null));
executeScrollSearch(client, sourceBuilder, k * numShards);
}
// test knn query + another query
{
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
sourceBuilder.query(
QueryBuilders.boolQuery()
.should(new KnnVectorQueryBuilder(VECTOR_FIELD, new float[] { 0, 0 }, k, 100, null, null))
.should(new KnnVectorQueryBuilder(VECTOR_FIELD, new float[] { 0, 0 }, k, 100, 10f, null, null))
.should(QueryBuilders.existsQuery("category").boost(10))
);
executeScrollSearch(client, sourceBuilder, k * numShards + 10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ public void testSimpleNested() throws Exception {

assertResponse(
prepareSearch("test").setKnnSearch(
List.of(new KnnSearchBuilder("nested.vector", new float[] { 1, 1, 1 }, 1, 1, null, null).innerHit(new InnerHitBuilder()))
List.of(
new KnnSearchBuilder("nested.vector", new float[] { 1, 1, 1 }, 1, 1, 10f, null, null).innerHit(new InnerHitBuilder())
)
).setAllowPartialSearchResults(false),
response -> assertThat(response.getHits().getHits().length, greaterThan(0))
);
Expand Down Expand Up @@ -153,7 +155,7 @@ private void testNestedWithTwoSegments(boolean flush) {
waitForRelocation(ClusterHealthStatus.GREEN);
refresh();

var knn = new KnnSearchBuilder("nested.vector", new float[] { -0.5f, 90.0f, -10f, 14.8f, -156.0f }, 2, 3, null, null);
var knn = new KnnSearchBuilder("nested.vector", new float[] { -0.5f, 90.0f, -10f, 14.8f, -156.0f }, 2, 3, 10f, null, null);
var request = prepareSearch("test").addFetchField("name").setKnnSearch(List.of(knn));
assertNoFailuresAndResponse(request, response -> {
assertHitCount(response, 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public void testProfileDfs() throws Exception {
new float[] { randomFloat(), randomFloat(), randomFloat() },
randomIntBetween(5, 10),
50,
10f,
randomBoolean() ? null : new RescoreVectorBuilder(randomFloatBetween(1.0f, 10.0f, false)),
randomBoolean() ? null : randomFloat()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ private record TestParams(
float[] queryVector,
int k,
int numCands,
float visitPercentage,
RescoreVectorBuilder rescoreVectorBuilder
) {
public static TestParams generate() {
Expand All @@ -128,6 +129,7 @@ public static TestParams generate() {
randomVector(numDims),
k,
(int) (k * randomFloatBetween(1.0f, 10.0f, true)),
randomFloatBetween(0.0f, 100.0f, true),
new RescoreVectorBuilder(randomFloatBetween(1.0f, 100f, true))
);
}
Expand All @@ -140,6 +142,7 @@ public void testKnnSearchRescore() {
testParams.queryVector,
testParams.k,
testParams.numCands,
testParams.visitPercentage,
testParams.rescoreVectorBuilder,
null
);
Expand All @@ -155,6 +158,7 @@ public void testKnnQueryRescore() {
testParams.queryVector,
testParams.k,
testParams.numCands,
testParams.visitPercentage,
testParams.rescoreVectorBuilder,
null
);
Expand All @@ -171,6 +175,7 @@ public void testKnnRetriever() {
null,
testParams.k,
testParams.numCands,
testParams.visitPercentage,
testParams.rescoreVectorBuilder,
null
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void testFilteredQueryStrategy() {
float[] vector = new float[16];
randomVector(vector, 25);
int upperLimit = 35;
var query = new KnnSearchBuilder(VECTOR_FIELD, vector, 1, 1, null, null).addFilterQuery(
var query = new KnnSearchBuilder(VECTOR_FIELD, vector, 1, 1, 10f, null, null).addFilterQuery(
QueryBuilders.rangeQuery(NUM_ID_FIELD).lte(35)
);
assertResponse(client().prepareSearch(INDEX_NAME).setKnnSearch(List.of(query)).setSize(1).setProfile(true), acornResponse -> {
Expand Down Expand Up @@ -133,7 +133,7 @@ public void testHnswEarlyTerminationQuery() {
float[] vector = new float[16];
randomVector(vector, 25);
int upperLimit = 35;
var query = new KnnSearchBuilder(VECTOR_FIELD, vector, 1, 1, null, null);
var query = new KnnSearchBuilder(VECTOR_FIELD, vector, 1, 1, 10f, null, null);
assertResponse(client().prepareSearch(INDEX_NAME).setKnnSearch(List.of(query)).setSize(1).setProfile(true), response -> {
assertNotEquals(0, response.getHits().getHits().length);
var profileResults = response.getProfileResults();
Expand Down
Loading
Loading