java.lang.Object
org.elasticsearch.action.search.SearchPhaseController
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final record
static final record
static final class
-
Constructor Summary
ConstructorsConstructorDescriptionSearchPhaseController
(BiFunction<Supplier<Boolean>, AggregatorFactories.Builder, AggregationReduceContext.Builder> requestToAggReduceContextBuilder) -
Method Summary
Modifier and TypeMethodDescriptionstatic AggregatedDfs
aggregateDfs
(Collection<DfsSearchResult> results) fillDocIdsToLoad
(int numShards, org.apache.lucene.search.ScoreDoc[] shardDocs) Builds an array, with potential null elements, with docs to load.static org.apache.lucene.search.ScoreDoc[]
getLastEmittedDocPerShard
(SearchPhaseController.ReducedQueryPhase reducedQueryPhase, int numShards) static SearchResponseSections
merge
(boolean ignoreFrom, SearchPhaseController.ReducedQueryPhase reducedQueryPhase, AtomicArray<? extends SearchPhaseResult> fetchResultsArray) Enriches search hits and completion suggestion hits fromsortedDocs
usingfetchResultsArr
, merges suggestions, aggregations and profile results Expects sortedDocs to have top search docs across all shards, optionally followed by top suggest docs for each named completion suggestion ordered by suggestion namestatic List<DfsKnnResults>
mergeKnnResults
(SearchRequest request, List<DfsSearchResult> dfsSearchResults)
-
Constructor Details
-
SearchPhaseController
public SearchPhaseController(BiFunction<Supplier<Boolean>, AggregatorFactories.Builder, AggregationReduceContext.Builder> requestToAggReduceContextBuilder)
-
-
Method Details
-
aggregateDfs
-
mergeKnnResults
public static List<DfsKnnResults> mergeKnnResults(SearchRequest request, List<DfsSearchResult> dfsSearchResults) -
getLastEmittedDocPerShard
public static org.apache.lucene.search.ScoreDoc[] getLastEmittedDocPerShard(SearchPhaseController.ReducedQueryPhase reducedQueryPhase, int numShards) -
fillDocIdsToLoad
public static List<Integer>[] fillDocIdsToLoad(int numShards, org.apache.lucene.search.ScoreDoc[] shardDocs) Builds an array, with potential null elements, with docs to load. -
merge
public static SearchResponseSections merge(boolean ignoreFrom, SearchPhaseController.ReducedQueryPhase reducedQueryPhase, AtomicArray<? extends SearchPhaseResult> fetchResultsArray) Enriches search hits and completion suggestion hits fromsortedDocs
usingfetchResultsArr
, merges suggestions, aggregations and profile results Expects sortedDocs to have top search docs across all shards, optionally followed by top suggest docs for each named completion suggestion ordered by suggestion name
-