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.
@BenTrent tells me that the knn query does not allow k to be set at all in knn queries (while it works in the top level knn objects). So you have to wait for the next Java client, sorry. The good news is that the specification was fixed.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.