Skip to content

Make k and num_candidates optional in kNN queries #2490

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

Merged
merged 4 commits into from
Apr 12, 2024

Conversation

pquentin
Copy link
Member

@pquentin pquentin commented Apr 8, 2024

This reflects the changes made in 8.13: elastic/elasticsearch#101209. The current situation forces setting values: https://discuss.elastic.co/t/knnquery-in-java-client/356645/1

@pquentin
Copy link
Member Author

pquentin commented Apr 8, 2024

The validation results appear to be worse than what we have on main currently, so I will investigate.

swallez
swallez previously requested changes Apr 8, 2024
Copy link
Member

@swallez swallez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KnnSearch is good, but there are some discrepancies on KnnQuery:

  • it must extend QueryBase to have the _name and boost fields (the latter should be removed from the type)
  • num_candidates should be optional
  • k and inner_hits should be removed.

Can you add these fixes?

@pquentin pquentin force-pushed the k-num-candidates-optional branch from 8fb436a to c07ed5e Compare April 9, 2024 10:28
@pquentin
Copy link
Member Author

pquentin commented Apr 9, 2024

Thanks, done! The CI failure is addressed in #2492.

@pquentin pquentin requested review from swallez and l-trotta April 12, 2024 07:23
Copy link
Contributor

Following you can find the validation results for the APIs you have changed.

API Status Request Response
async_search.submit 🔴 4/7 6/7
msearch 🔴 14/17 15/16
search 🔴 1328/1942 1876/1924

You can validate these APIs yourself by using the make validate target.

@pquentin pquentin merged commit 4718254 into main Apr 12, 2024
@pquentin pquentin deleted the k-num-candidates-optional branch April 12, 2024 07:43
github-actions bot pushed a commit that referenced this pull request Apr 12, 2024
* Make k and num_candidates optional in kNN queries

* Address review comments

(cherry picked from commit 4718254)
pquentin added a commit that referenced this pull request Apr 12, 2024
* Make k and num_candidates optional in kNN queries

* Address review comments

(cherry picked from commit 4718254)

Co-authored-by: Quentin Pradet <quentin.pradet@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants