Skip to content

Add 'knn' property to Search request body#1792

Merged
sethmlarson merged 3 commits intomainfrom
search-knn
Aug 4, 2022
Merged

Add 'knn' property to Search request body#1792
sethmlarson merged 3 commits intomainfrom
search-knn

Conversation

@sethmlarson
Copy link
Copy Markdown
Contributor

@sethmlarson sethmlarson commented Jul 26, 2022

Adds changes from these PRs:

Which add the knn property to the Search request body.

Questions for @jtibshirani:

  • Is there a knn property for Async Search as well?
  • Should we remove the knn query filter? I didn't see it documented on elastic.co and wasn't sure if it was supposed to be there.

Closes #1779

@jtibshirani
Copy link
Copy Markdown

Thanks @sethmlarson ! Responses to your questions:

@sethmlarson
Copy link
Copy Markdown
Contributor Author

@jtibshirani Sorry, my second question was a bit ambiguous. I was asking about the knn section under QueryContainer. I'm asking if the below is a valid search request body:

POST /<index>/_search
{
  "query": {
    "knn": {
      "field": "...",
      ...
    }
  }
}

@jtibshirani
Copy link
Copy Markdown

No, this is not valid. The knn section is a new top-level section in the search request. There is no such thing as a knn query type right now.

@sethmlarson
Copy link
Copy Markdown
Contributor Author

@jtibshirani That's what I thought, it looks like that snuck into the spec in a previous review.

Copy link
Copy Markdown

@jtibshirani jtibshirani left a comment

Choose a reason for hiding this comment

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

This looks good to me from the API perspective (I'm not an expert in this spec though).

@sethmlarson
Copy link
Copy Markdown
Contributor Author

@swallez Thanks for the review, I've updated the PR with your comments.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Aug 4, 2022

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

API Status Request Response
async_search.submit 🟢 7/7 7/7
msearch 🟢 17/17 16/16
search 🔴 1483/1540 1508/1522

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

Copy link
Copy Markdown
Contributor

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

LGTM!

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.

Add the knn property to search requests

3 participants