Skip to content

Conversation

kaushikau
Copy link
Contributor

Description

This is a follow-up to #2826, and adds support for the expandNested query parameter in the exact_knn query. This allows for all child document scores to be retrieved instead of only the highest-scoring one.

Example of query with expandNested:

{
  "size": 2,
  "query": {
    "exact_knn": {
      "my_vector": {
        "vector": [2, 3, 5, 6],
        "space_type": "l2",
        "expand_nested_docs": "true"
      }
    }
  }
}

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Kaushika Uppu <[email protected]>
Signed-off-by: Kaushika Uppu <[email protected]>
Comment on lines +71 to +72
docId = getNextDocId();
return nextDoc();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just for clarification, what case is this handling? I think if it hits this case then docId will already be -1 right? is it safe to return no more docs here?


if (expandNested) {
int currentParent = parentBitSet.nextSetBit(docId);
if (currentParent != DocIdSetIterator.NO_MORE_DOCS && docId < currentParent) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

will there be a case where docId won't be less than parent? it will either be NO_MORE_DOCS or less than parent right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants