Fixed merge logic in hybrid query for multiple shards case #876
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fix for scenario in hybrid query search when:
It's a gap in existing code, we only handle scenarios when merged result object is not empty and we're merging it with an empty result object.
The issue isn't trivial to repro because the sequence in which segment/shard results are passed to a merger isn't guaranteed, and we need to ingest documents and run search multiple times. Credit for providing a tool to replicate the issue goes to @eemmiirr, I used his script https://github.com/eemmiirr/opensearch-concurrent-segment-search-bug.
Related Issues
Resolves #875
Check List
--signoff
.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.