Skip to content

Required parameter K in KnnQuery #774

Closed
@AJStorteeboom

Description

@AJStorteeboom

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: SpecificationRelated to the API spec used to generate client code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions