Skip to content

Commit

Permalink
iter
Browse files Browse the repository at this point in the history
  • Loading branch information
javanna committed Apr 2, 2024
1 parent 2fd6901 commit aa9a371
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.elasticsearch.common.util.LongObjectPagedHashMap.Cursor;
import org.elasticsearch.core.Releasables;
import org.elasticsearch.index.query.SearchExecutionContext;
import org.elasticsearch.search.NestedDocuments;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.SearchHits;
import org.elasticsearch.search.aggregations.AggregationExecutionContext;
Expand Down Expand Up @@ -218,7 +219,14 @@ public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOE

private static FetchSearchResult runFetchPhase(SubSearchContext subSearchContext, int[] docIdsToLoad) {
// Fork the search execution context for each slice, because the fetch phase does not support concurrent execution yet.
SearchExecutionContext searchExecutionContext = new SearchExecutionContext(subSearchContext.getSearchExecutionContext());
SearchExecutionContext searchExecutionContext = new SearchExecutionContext(subSearchContext.getSearchExecutionContext()) {
@Override
public NestedDocuments getNestedDocuments() {
// this is a horrible hack: AggregationTestCase mocks SearchExecutionContext to override the resolution of nested documents.
// That gets lost as we fork the search execution context: overriding this method preserves that.
return subSearchContext.getSearchExecutionContext().getNestedDocuments();
}
};
SubSearchContext fetchSubSearchContext = new SubSearchContext(subSearchContext) {
@Override
public SearchExecutionContext getSearchExecutionContext() {
Expand Down

0 comments on commit aa9a371

Please sign in to comment.