elasticsearch-java icon indicating copy to clipboard operation
elasticsearch-java copied to clipboard

Required parameter K in KnnQuery

Open AJStorteeboom opened this issue 1 year ago • 1 comments

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

AJStorteeboom avatar Apr 04 '24 09:04 AJStorteeboom

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.

l-trotta avatar Apr 04 '24 10:04 l-trotta

Is there an update on when we release this fix?

jerryguowei avatar Apr 15 '24 00:04 jerryguowei

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

l-trotta avatar Apr 15 '24 07:04 l-trotta

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

elias-fauser avatar Apr 18 '24 12:04 elias-fauser

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

l-trotta avatar Apr 18 '24 14:04 l-trotta

fixed in 8.13.3

l-trotta avatar May 06 '24 08:05 l-trotta