elastic/elasticsearch-java

KnnQuery missing the InnerHits field

pankajkrastogi opened this issue · 1 comments

Description

According to nested Knn search, inner_hits can be provided to return the matching snippets.

https://www.elastic.co/guide/en/elasticsearch/reference/current/knn-search.html#nested-knn-search-inner-hits

However, the client library does not have an option to set inner_hits while building the KnnQuery.

https://github.com/elastic/elasticsearch-java/blob/main/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/KnnQuery.java

I was looking for something similar already available for NestedQuery:

https://github.com/elastic/elasticsearch-java/blob/main/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/NestedQuery.java

I tried to scan the code so I could find an alternative solution. However, I haven't had any luck so far.
Does anyone know any alternative way to perform Knn nested search with inner_hits?

Thanks for reporting this. It's an issue in the API specification used to produce the Java code.

That part is indeed missing from the API specification that is used to generate the code. Once the API specification is fixed (see elastic/elasticsearch-specification#2406), the Java client code will be updated to resolve this issue.