Skip to content

Commit 71d3a48

Browse files
committed
Fix min_candidates handling
1 parent 66e3dcb commit 71d3a48

File tree

1 file changed

+1
-0
lines changed
  • x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/querydsl/query

1 file changed

+1
-0
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/querydsl/query/KnnQuery.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ protected QueryBuilder asBuilder() {
5454
Float vectorSimilarity = (Float) options.get(VECTOR_SIMILARITY_FIELD.getPreferredName());
5555
Integer minCandidates = (Integer) options.get(Knn.MIN_CANDIDATES_OPTION);
5656
int adjustedK = Math.max(k, minCandidates == null ? 0 : minCandidates);
57+
minCandidates = minCandidates == null ? null : Math.max(minCandidates, adjustedK);
5758

5859
KnnVectorQueryBuilder queryBuilder = new KnnVectorQueryBuilder(
5960
field,

0 commit comments

Comments
 (0)