Omit maxScoreCollector for field collapsing when sort by score descending#19181
Conversation
…ding Signed-off-by: Binlong Gao <gbinlong@amazon.com>
Signed-off-by: Binlong Gao <gbinlong@amazon.com>
Signed-off-by: Binlong Gao <gbinlong@amazon.com>
|
❌ Gradle check result for 23018ff: 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? |
|
❕ Gradle check result for 23018ff: UNSTABLE Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #19181 +/- ##
============================================
+ Coverage 72.84% 72.87% +0.02%
+ Complexity 69857 69823 -34
============================================
Files 5674 5674
Lines 320901 320911 +10
Branches 46394 46397 +3
============================================
+ Hits 233756 233856 +100
+ Misses 68205 68116 -89
+ Partials 18940 18939 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
server/src/main/java/org/opensearch/search/query/TopDocsCollectorContext.java
Show resolved
Hide resolved
Signed-off-by: Binlong Gao <gbinlong@amazon.com>
|
❌ Gradle check result for 82eb922: 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? |
|
❌ Gradle check result for c5b8098: 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? |
server/src/main/java/org/opensearch/search/query/TopDocsCollectorContext.java
Show resolved
Hide resolved
…ding (opensearch-project#19181) * Omit maxScoreCollector for field collapsing when sort by score descending Signed-off-by: Binlong Gao <gbinlong@amazon.com> * Modify change log Signed-off-by: Binlong Gao <gbinlong@amazon.com> * Add yaml rest test Signed-off-by: Binlong Gao <gbinlong@amazon.com> --------- Signed-off-by: Binlong Gao <gbinlong@amazon.com>
…ding (opensearch-project#19181) * Omit maxScoreCollector for field collapsing when sort by score descending Signed-off-by: Binlong Gao <gbinlong@amazon.com> * Modify change log Signed-off-by: Binlong Gao <gbinlong@amazon.com> * Add yaml rest test Signed-off-by: Binlong Gao <gbinlong@amazon.com> --------- Signed-off-by: Binlong Gao <gbinlong@amazon.com>
Description
Similar to SimpleTopDocsCollectorContext, we can omit the MaxScoreCollector when sorting by score in CollapsingTopDocsCollectorContext, this can reduce the search latency and cpu usage.
By a benchmark test against the big5 index and other indices, this change can achieve 10%-20% performance improvement in both concurrent segment search enabled and disabled.
The query DSL on big5 index is:
, the benchmark result:
In addition, this PR fixes the bug that max_score is null when we have multiple sort fields and _score is used as a primary sort.
Related Issues
Resolves #19179 and partly resolves #19180.
Check List
- [ ] 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.