java.lang.Object
org.elasticsearch.search.internal.SearchContext
org.elasticsearch.search.rank.RankSearchContext
- All Implemented Interfaces:
Closeable,AutoCloseable,Releasable
Manages the appropriate values when executing multiple queries
on behalf of ranking for a single ranking query.
-
Field Summary
Fields inherited from class org.elasticsearch.search.internal.SearchContext
DEFAULT_TERMINATE_AFTER, DEFAULT_TRACK_TOTAL_HITS_UP_TO, releasables, TRACK_TOTAL_HITS_ACCURATE, TRACK_TOTAL_HITS_DISABLED -
Constructor Summary
ConstructorsConstructorDescriptionRankSearchContext(SearchContext parent, org.apache.lucene.search.Query rankQuery, int rankWindowSize) -
Method Summary
Modifier and TypeMethodDescriptionvoidIndicates that the caller will be using, and thus owning, aDfsSearchResultobject.voidIndicates that the caller will be using, and thus owning, aFetchSearchResultobject.voidIndicates that the caller will be using, and thus owning, aQuerySearchResultobject.voidvoidaddRescore(RescoreContext rescore) Aggregations are run as a separate query.aggregations(SearchContextAggregations aggregations) org.apache.lucene.search.QuerybuildFilteredQuery(org.apache.lucene.search.Query query) Automatically apply all required filters to the given query such as alias filters, types filters, etc.collapse()Collapse is not supported by ranking.docValuesContext(FetchDocValuesContext docValuesContext) booleanexplain()voidexplain(boolean explain) The context related to retrieving fields.fetchFieldsContext(FetchFieldsContext fetchFieldsContext) Sets the context related to retrieving fields.fetchSourceContext(FetchSourceContext fetchSourceContext) intfrom()from(int from) floatProfiling is not supported by ranking.longReturns time in milliseconds that can be used for relative time calculations.getSearchExt(String name) getTask()org.apache.lucene.search.TotalHitsbooleanbooleanvoidhighlight(SearchHighlightContext highlight) id()booleanbooleanIndicates if the current index should perform frequent low level search cancellation check.minimumScore(float minimumScore) Build something to load source_source.intparsedPostFilter(ParsedQuery postFilter) parsedQuery(ParsedQuery query) voidShould be called before executing the main query and after all other parameters have been set.org.apache.lucene.search.Queryquery()Use a single rank query.voidqueryPhaseRankShardContext(QueryPhaseRankShardContext queryPhaseRankShardContext) Use a separate query search result.request()rescore()Rescore is not supported by ranking.Ranking is not allowed with scroll.org.apache.lucene.search.FieldDocsearchAfter(org.apache.lucene.search.FieldDoc searchAfter) searcher()booleanindicates whether the sequence number and primary term of the last modification to each hit should be returnedvoidseqNoAndPrimaryTerm(boolean seqNoAndPrimaryTerm) controls whether the sequence number and primary term of the last modification to each hit should be returnedvoidsetTask(SearchShardTask task) intsize()size(int size) sort()Sort is not allowed with ranking.sort(SortAndFormats sort) source()booleanA shortcut function to see whether there is a fetchSourceContext and it says the source is requested.storedFieldsContext(StoredFieldsContext storedFieldsContext) suggest()voidsuggest(SuggestionSearchContext suggest) intvoidterminateAfter(int terminateAfter) timeout()booleantrackScores(boolean trackScores) intTotal hits are tracked as part of a separate query.trackTotalHitsUpTo(int trackTotalHits) booleanversion()voidversion(boolean version) Methods inherited from class org.elasticsearch.search.internal.SearchContext
addReleasable, assignRescoreDocIds, close, getCancellationChecks, hasOnlySuggest, rescoreDocIds, rewrittenQuery, toString
-
Constructor Details
-
RankSearchContext
public RankSearchContext(SearchContext parent, org.apache.lucene.search.Query rankQuery, int rankWindowSize)
-
-
Method Details
-
request
- Specified by:
requestin classSearchContext
-
shardTarget
- Specified by:
shardTargetin classSearchContext
-
scrollContext
Ranking is not allowed with scroll.- Specified by:
scrollContextin classSearchContext
-
aggregations
Aggregations are run as a separate query.- Specified by:
aggregationsin classSearchContext
-
rescore
Rescore is not supported by ranking.- Specified by:
rescorein classSearchContext- Returns:
- list of all rescore contexts. empty if there aren't any.
-
searcher
- Specified by:
searcherin classSearchContext
-
indexShard
- Specified by:
indexShardin classSearchContext
-
timeout
- Specified by:
timeoutin classSearchContext
-
terminateAfter
public int terminateAfter()- Specified by:
terminateAfterin classSearchContext
-
minimumScore
- Specified by:
minimumScorein classSearchContext
-
sort
Sort is not allowed with ranking.- Specified by:
sortin classSearchContext
-
trackScores
public boolean trackScores()- Specified by:
trackScoresin classSearchContext
-
trackTotalHitsUpTo
public int trackTotalHitsUpTo()Total hits are tracked as part of a separate query.- Specified by:
trackTotalHitsUpToin classSearchContext
-
searchAfter
public org.apache.lucene.search.FieldDoc searchAfter()- Specified by:
searchAfterin classSearchContext
-
collapse
Collapse is not supported by ranking.- Specified by:
collapsein classSearchContext
-
parsedPostFilter
- Specified by:
parsedPostFilterin classSearchContext
-
query
public org.apache.lucene.search.Query query()Use a single rank query.- Specified by:
queryin classSearchContext
-
from
public int from()- Specified by:
fromin classSearchContext
-
size
public int size()- Specified by:
sizein classSearchContext
-
queryResult
Use a separate query search result.- Specified by:
queryResultin classSearchContext
-
getProfilers
Profiling is not supported by ranking.- Specified by:
getProfilersin classSearchContext
-
getRelativeTimeInMillis
public long getRelativeTimeInMillis()Description copied from class:SearchContextReturns time in milliseconds that can be used for relative time calculations. WARN: This is not the epoch time.- Specified by:
getRelativeTimeInMillisin classSearchContext
-
setTask
- Specified by:
setTaskin classSearchContext
-
getTask
- Specified by:
getTaskin classSearchContext
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin classSearchContext
-
preProcess
public void preProcess()Description copied from class:SearchContextShould be called before executing the main query and after all other parameters have been set.- Specified by:
preProcessin classSearchContext
-
buildFilteredQuery
public org.apache.lucene.search.Query buildFilteredQuery(org.apache.lucene.search.Query query) Description copied from class:SearchContextAutomatically apply all required filters to the given query such as alias filters, types filters, etc.- Specified by:
buildFilteredQueryin classSearchContext
-
id
- Specified by:
idin classSearchContext
-
source
- Specified by:
sourcein classSearchContext
-
searchType
- Specified by:
searchTypein classSearchContext
-
numberOfShards
public int numberOfShards()- Specified by:
numberOfShardsin classSearchContext
-
aggregations
- Specified by:
aggregationsin classSearchContext
-
getSearchExt
- Specified by:
getSearchExtin classSearchContext
-
highlight
- Specified by:
highlightin classSearchContext
-
highlight
- Specified by:
highlightin classSearchContext
-
innerHits
- Overrides:
innerHitsin classSearchContext
-
suggest
- Specified by:
suggestin classSearchContext
-
suggest
-
queryPhaseRankShardContext
- Specified by:
queryPhaseRankShardContextin classSearchContext
-
queryPhaseRankShardContext
- Specified by:
queryPhaseRankShardContextin classSearchContext
-
addRescore
- Specified by:
addRescorein classSearchContext
-
hasScriptFields
public boolean hasScriptFields()- Specified by:
hasScriptFieldsin classSearchContext
-
scriptFields
- Specified by:
scriptFieldsin classSearchContext
-
sourceRequested
public boolean sourceRequested()Description copied from class:SearchContextA shortcut function to see whether there is a fetchSourceContext and it says the source is requested.- Specified by:
sourceRequestedin classSearchContext
-
fetchSourceContext
- Specified by:
fetchSourceContextin classSearchContext
-
fetchSourceContext
- Specified by:
fetchSourceContextin classSearchContext
-
docValuesContext
- Specified by:
docValuesContextin classSearchContext
-
docValuesContext
- Specified by:
docValuesContextin classSearchContext
-
fetchFieldsContext
Description copied from class:SearchContextThe context related to retrieving fields.- Specified by:
fetchFieldsContextin classSearchContext
-
fetchFieldsContext
Description copied from class:SearchContextSets the context related to retrieving fields.- Specified by:
fetchFieldsContextin classSearchContext
-
bitsetFilterCache
- Specified by:
bitsetFilterCachein classSearchContext
-
terminateAfter
public void terminateAfter(int terminateAfter) - Specified by:
terminateAfterin classSearchContext
-
lowLevelCancellation
public boolean lowLevelCancellation()Description copied from class:SearchContextIndicates if the current index should perform frequent low level search cancellation check. Enabling low-level checks will make long running searches to react to the cancellation request faster. However, since it will produce more cancellation checks it might slow the search performance down.- Specified by:
lowLevelCancellationin classSearchContext
-
minimumScore
- Specified by:
minimumScorein classSearchContext
-
sort
- Specified by:
sortin classSearchContext
-
trackScores
- Specified by:
trackScoresin classSearchContext
-
trackTotalHitsUpTo
- Specified by:
trackTotalHitsUpToin classSearchContext
-
searchAfter
- Specified by:
searchAfterin classSearchContext
-
parsedPostFilter
- Specified by:
parsedPostFilterin classSearchContext
-
parsedQuery
- Specified by:
parsedQueryin classSearchContext
-
parsedQuery
- Specified by:
parsedQueryin classSearchContext
-
from
- Specified by:
fromin classSearchContext
-
size
- Specified by:
sizein classSearchContext
-
hasStoredFields
public boolean hasStoredFields()- Specified by:
hasStoredFieldsin classSearchContext
-
storedFieldsContext
- Specified by:
storedFieldsContextin classSearchContext
-
storedFieldsContext
- Specified by:
storedFieldsContextin classSearchContext
-
explain
public boolean explain()- Specified by:
explainin classSearchContext
-
explain
public void explain(boolean explain) - Specified by:
explainin classSearchContext
-
groupStats
- Specified by:
groupStatsin classSearchContext
-
version
public boolean version()- Specified by:
versionin classSearchContext
-
version
public void version(boolean version) - Specified by:
versionin classSearchContext
-
seqNoAndPrimaryTerm
public boolean seqNoAndPrimaryTerm()Description copied from class:SearchContextindicates whether the sequence number and primary term of the last modification to each hit should be returned- Specified by:
seqNoAndPrimaryTermin classSearchContext
-
seqNoAndPrimaryTerm
public void seqNoAndPrimaryTerm(boolean seqNoAndPrimaryTerm) Description copied from class:SearchContextcontrols whether the sequence number and primary term of the last modification to each hit should be returned- Specified by:
seqNoAndPrimaryTermin classSearchContext
-
dfsResult
- Specified by:
dfsResultin classSearchContext
-
addDfsResult
public void addDfsResult()Description copied from class:SearchContextIndicates that the caller will be using, and thus owning, aDfsSearchResultobject. It is the caller's responsibility to correctly cleanup this result object.- Specified by:
addDfsResultin classSearchContext
-
addQueryResult
public void addQueryResult()Description copied from class:SearchContextIndicates that the caller will be using, and thus owning, aQuerySearchResultobject. It is the caller's responsibility to correctly cleanup this result object.- Specified by:
addQueryResultin classSearchContext
-
getTotalHits
public org.apache.lucene.search.TotalHits getTotalHits()- Specified by:
getTotalHitsin classSearchContext
-
getMaxScore
public float getMaxScore()- Specified by:
getMaxScorein classSearchContext
-
fetchPhase
- Specified by:
fetchPhasein classSearchContext
-
addRankFeatureResult
public void addRankFeatureResult()- Specified by:
addRankFeatureResultin classSearchContext
-
rankFeatureResult
- Specified by:
rankFeatureResultin classSearchContext
-
fetchResult
- Specified by:
fetchResultin classSearchContext
-
addFetchResult
public void addFetchResult()Description copied from class:SearchContextIndicates that the caller will be using, and thus owning, aFetchSearchResultobject. It is the caller's responsibility to correctly cleanup this result object.- Specified by:
addFetchResultin classSearchContext
-
getSearchExecutionContext
- Specified by:
getSearchExecutionContextin classSearchContext
-
readerContext
- Specified by:
readerContextin classSearchContext
-
newSourceLoader
Description copied from class:SearchContextBuild something to load source_source.- Specified by:
newSourceLoaderin classSearchContext
-
newIdLoader
- Specified by:
newIdLoaderin classSearchContext
-