Skip to content

Add support of KNN queries #2433

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
manosetro opened this issue Jan 24, 2023 · 3 comments · Fixed by #2458
Closed

Add support of KNN queries #2433

manosetro opened this issue Jan 24, 2023 · 3 comments · Fixed by #2458
Labels
type: enhancement A general enhancement

Comments

@manosetro
Copy link

manosetro commented Jan 24, 2023

Since version 8.4 of the elasticsearch-java client, KnnQuery implements only JsonpSerializable.

Before that change it was defined as:
public class KnnQuery extends QueryBase implements QueryVariant

As a result, the KnnQuery cannot be used in the NativeQuery class.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 24, 2023
@sothawo
Copy link
Collaborator

sothawo commented Jan 24, 2023

That's not an issue of Spring Data Elasticsearch but of Elasticsearch, you might want to a open an issue in their repository.

@sothawo sothawo closed this as not planned Won't fix, can't repro, duplicate, stale Jan 24, 2023
@manosetro
Copy link
Author

The issue here is that the change in elasticsearch-java has been made to conform to the underlying API's specs.

The knn option is now part of the request body of the _search endpoint. Similarly to docvalue_fields, point in time (PIT), etc.

I cannot find how the knn option can be send in the _search request in the current version of Spring-Data-Elasticsearch.
I suppose that the way to support KnnQuery is to add a .withKnnQuery method in the NativeQuery class.

Did I miss anything?

@sothawo
Copy link
Collaborator

sothawo commented Jan 24, 2023

Ok, that would needed to be added to the NativeQuery, the builder and then be used when buildig the actual Elasticsearch client searchquery.

@sothawo sothawo reopened this Jan 24, 2023
@sothawo sothawo added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Jan 24, 2023
sothawo added a commit to sothawo/spring-data-elasticsearch that referenced this issue Feb 14, 2023
@sothawo sothawo added this to the 5.1 M1 (2023.0.0) milestone Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants