Skip to content
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

Add a flag in QueryShardContext to differentiate inner hit query #16600

Merged
merged 1 commit into from
Nov 11, 2024

Conversation

heemin32
Copy link
Contributor

@heemin32 heemin32 commented Nov 8, 2024

Description

Add a flag in QueryShardContext to differentiate inner hit query and normal query.

For k-NN nested fields, the query currently searches for the nested field document with the highest score for each parent document, returning only a single nested field document in the inner hit block. We want to modify this query behavior to retrieve all nested field documents in the inner hit block, rather than just the one with the highest score. To implement this, we need to identify whether the current query request is targeting an inner hit block or not.

Alternatives

  • One alternatives is using stack trace to see if the query is made inside NestedInnerHitContextBuilder. This will increase query latency.
  • Another alternative is making the k-NN nested query behavior to be same regardless it is for inner hit block or not. This will break backward compatibility because the score of parent doc will get changed from max to avg as we are returning multiple nested fields docs.

Related Issues

Resolves opensearch-project/k-NN#2249

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

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.

Copy link
Contributor

github-actions bot commented Nov 8, 2024

❌ Gradle check result for 11f7980: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

…ry and an inner hit query

Signed-off-by: Heemin Kim <heemin@amazon.com>
Copy link
Contributor

github-actions bot commented Nov 9, 2024

✅ Gradle check result for 7f16389: SUCCESS

Copy link

codecov bot commented Nov 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.04%. Comparing base (e688388) to head (7f16389).
Report is 5 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #16600      +/-   ##
============================================
- Coverage     72.15%   72.04%   -0.11%     
+ Complexity    65128    65065      -63     
============================================
  Files          5315     5315              
  Lines        303573   303578       +5     
  Branches      43925    43925              
============================================
- Hits         219036   218707     -329     
- Misses        66565    66940     +375     
+ Partials      17972    17931      -41     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@msfroh msfroh added the backport 2.x Backport to 2.x branch label Nov 11, 2024
Copy link
Collaborator

@msfroh msfroh left a comment

Choose a reason for hiding this comment

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

Thanks, @heemin32. This makes sense!

@msfroh msfroh merged commit c9edb48 into opensearch-project:main Nov 11, 2024
43 of 44 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Nov 11, 2024
…ry and an inner hit query (#16600)

Signed-off-by: Heemin Kim <heemin@amazon.com>
(cherry picked from commit c9edb48)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
dbwiddis pushed a commit that referenced this pull request Nov 13, 2024
…ry and an inner hit query (#16600) (#16620)

(cherry picked from commit c9edb48)

Signed-off-by: Heemin Kim <heemin@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Signed-off-by: Michael Froh <froh@amazon.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Michael Froh <froh@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC] Multiple inner hits for nested field
2 participants