Required parameter K in KnnQuery
Java API client version
8.13
Java version
17
Elasticsearch Version
12
Problem description
I am trying to execute a KnnQuery (Knn query | Elasticsearch Guide [8.13] | Elastic 1) in my java application
(So not the knn search: k-nearest neighbor (kNN) search | Elasticsearch Guide [8.13] | Elastic).
When you use knn in a query, you can't set parameter k since the size parameter is used.
But, the Java client with version 8.13 requires the k parameter: (co.elastic.clients.util.MissingRequiredPropertyException: Missing required property 'KnnQuery.k' )
So my problem is kind of a deadlock. Elasticsearch doesn't support the k parameter when knn is used in a query, but the java client requires the k parameter.
I've posted it on the forum of elastic and they told me to create an issue since it is a bug: https://discuss.elastic.co/t/knnquery-in-java-client/356645
Hello, thank you for the report! This is an issue in the API specification used to produce the Java code, we'll fix it and then regenerate the client to solve this.
Is there an update on when we release this fix?
It was recently fixed in the spec with this PR, so it should be in the next release of the client.
@l-trotta We are very happy the issue was quickly fixed. We are currently actively waiting for this fix in order to deploy a query update. Is there any information on when the next release will take place?
there should be a new release before the end of next month, I'll ping you in case of an earlier release.
fixed in 8.13.3