Set subSearchContext.topDocs after the rescoring in TopDocsAggs
This change fixes a bug introduced in https://github.com/elastic/elasticsearch/pull/20978 The top docs should be set in the subSearchContext after the rescoring
This commit is contained in:
parent
5495b66797
commit
05915357c9
|
@ -141,7 +141,6 @@ public class TopHitsAggregator extends MetricsAggregator {
|
|||
topHits = buildEmptyAggregation();
|
||||
} else {
|
||||
TopDocs topDocs = topDocsCollector.topLevelCollector.topDocs();
|
||||
subSearchContext.queryResult().topDocs(topDocs, subSearchContext.sort() == null ? null : subSearchContext.sort().formats);
|
||||
if (subSearchContext.sort() == null) {
|
||||
for (RescoreSearchContext ctx : context().searchContext().rescore()) {
|
||||
try {
|
||||
|
@ -151,7 +150,8 @@ public class TopHitsAggregator extends MetricsAggregator {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
subSearchContext.queryResult().topDocs(topDocs,
|
||||
subSearchContext.sort() == null ? null : subSearchContext.sort().formats);
|
||||
int[] docIdsToLoad = new int[topDocs.scoreDocs.length];
|
||||
for (int i = 0; i < topDocs.scoreDocs.length; i++) {
|
||||
docIdsToLoad[i] = topDocs.scoreDocs[i].doc;
|
||||
|
|
Loading…
Reference in New Issue