public final class SearchPhaseController extends AbstractComponent
Modifier and Type | Class | Description |
---|---|---|
static class |
SearchPhaseController.ReducedQueryPhase |
deprecationLogger, logger, settings
Constructor | Description |
---|---|
SearchPhaseController(Settings settings,
java.util.function.Function<java.lang.Boolean,InternalAggregation.ReduceContext> reduceContextFunction) |
Constructor.
|
Modifier and Type | Method | Description |
---|---|---|
AggregatedDfs |
aggregateDfs(java.util.Collection<DfsSearchResult> results) |
|
com.carrotsearch.hppc.IntArrayList[] |
fillDocIdsToLoad(int numShards,
org.apache.lucene.search.ScoreDoc[] shardDocs) |
Builds an array, with potential null elements, with docs to load.
|
org.apache.lucene.search.ScoreDoc[] |
getLastEmittedDocPerShard(SearchPhaseController.ReducedQueryPhase reducedQueryPhase,
int numShards) |
|
InternalSearchResponse |
merge(boolean ignoreFrom,
SearchPhaseController.ReducedQueryPhase reducedQueryPhase,
java.util.Collection<? extends SearchPhaseResult> fetchResults,
java.util.function.IntFunction<SearchPhaseResult> resultsLookup) |
Enriches search hits and completion suggestion hits from
sortedDocs using fetchResultsArr ,
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 |
SearchPhaseController.ReducedQueryPhase |
reducedQueryPhase(java.util.Collection<? extends SearchPhaseResult> queryResults,
boolean isScrollRequest) |
Reduces the given query results and consumes all aggregations and profile results.
|
SearchPhaseController.ReducedQueryPhase |
reducedQueryPhase(java.util.Collection<? extends SearchPhaseResult> queryResults,
boolean isScrollRequest,
boolean trackTotalHits) |
Reduces the given query results and consumes all aggregations and profile results.
|
org.elasticsearch.action.search.SearchPhaseController.SortedTopDocs |
sortDocs(boolean ignoreFrom,
java.util.Collection<? extends SearchPhaseResult> results,
java.util.Collection<org.apache.lucene.search.TopDocs> bufferedTopDocs,
org.elasticsearch.action.search.SearchPhaseController.TopDocsStats topDocsStats,
int from,
int size) |
Returns a score doc array of top N search docs across all shards, followed by top suggest docs for each
named completion suggestion across all shards.
|
logDeprecatedSetting, logRemovedSetting, nodeName
public SearchPhaseController(Settings settings, java.util.function.Function<java.lang.Boolean,InternalAggregation.ReduceContext> reduceContextFunction)
settings
- Node settingsreduceContextFunction
- A function that builds a context for the reduce of an InternalAggregation
public AggregatedDfs aggregateDfs(java.util.Collection<DfsSearchResult> results)
public org.elasticsearch.action.search.SearchPhaseController.SortedTopDocs sortDocs(boolean ignoreFrom, java.util.Collection<? extends SearchPhaseResult> results, java.util.Collection<org.apache.lucene.search.TopDocs> bufferedTopDocs, org.elasticsearch.action.search.SearchPhaseController.TopDocsStats topDocsStats, int from, int size)
ignoreFrom
- Whether to ignore the from and sort all hits in each shard result.
Enabled only for scroll search, because that only retrieves hits of length 'size' in the query phase.results
- the search phase results to obtain the sort docs frombufferedTopDocs
- the pre-consumed buffered top docstopDocsStats
- the top docs stats to fillfrom
- the offset into the search results top docssize
- the number of hits to return from the merged top docspublic org.apache.lucene.search.ScoreDoc[] getLastEmittedDocPerShard(SearchPhaseController.ReducedQueryPhase reducedQueryPhase, int numShards)
public com.carrotsearch.hppc.IntArrayList[] fillDocIdsToLoad(int numShards, org.apache.lucene.search.ScoreDoc[] shardDocs)
public InternalSearchResponse merge(boolean ignoreFrom, SearchPhaseController.ReducedQueryPhase reducedQueryPhase, java.util.Collection<? extends SearchPhaseResult> fetchResults, java.util.function.IntFunction<SearchPhaseResult> resultsLookup)
sortedDocs
using fetchResultsArr
,
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 namepublic SearchPhaseController.ReducedQueryPhase reducedQueryPhase(java.util.Collection<? extends SearchPhaseResult> queryResults, boolean isScrollRequest)
queryResults
- a list of non-null query shard resultspublic SearchPhaseController.ReducedQueryPhase reducedQueryPhase(java.util.Collection<? extends SearchPhaseResult> queryResults, boolean isScrollRequest, boolean trackTotalHits)
queryResults
- a list of non-null query shard results