elastic / elasticsearch-java

Official Elasticsearch Java Client
Apache License 2.0
408 stars 237 forks source link

Required parameter K in KnnQuery #774

Closed AJStorteeboom closed 4 months ago

AJStorteeboom commented 5 months ago

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.

image

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

l-trotta commented 5 months ago

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.

jerryguowei commented 4 months ago

Is there an update on when we release this fix?

l-trotta commented 4 months ago

It was recently fixed in the spec with this PR, so it should be in the next release of the client.

elias-fauser commented 4 months ago

@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?

l-trotta commented 4 months ago

there should be a new release before the end of next month, I'll ping you in case of an earlier release.

l-trotta commented 4 months ago

fixed in 8.13.3