Class SubSearchContext
java.lang.Object
org.elasticsearch.search.internal.SearchContext
org.elasticsearch.search.internal.FilteredSearchContext
org.elasticsearch.search.internal.SubSearchContext
- All Implemented Interfaces:
Closeable,AutoCloseable,org.elasticsearch.core.Releasable
- Direct Known Subclasses:
InnerHitsContext.InnerHitSubContext
-
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaggregations(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()int[]docIdsToLoad(int[] docIdsToLoad, int docsIdsToLoadSize)intdocValuesContext(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)longReturns time in milliseconds that can be used for relative time calculations.voidgroupStats(List<String> groupStats)booleanbooleanbooleanvoidhighlight(SearchHighlightContext highlight)minimumScore(float minimumScore)parsedPostFilter(ParsedQuery postFilter)parsedQuery(ParsedQuery parsedQuery)voidpreProcess(boolean rewrite)Should be called before executing the main query and after all other parameters have been set.org.apache.lucene.search.Queryquery()The query to execute, might be rewritten.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 returnedintsize()size(int size)sort()sort(SortAndFormats sort)booleanA shortcut function to see whether there is a fetchSourceContext and it says the source is requested.storedFieldsContext(StoredFieldsContext storedFieldsContext)voidsuggest(SuggestionSearchContext suggest)voidterminateAfter(int terminateAfter)voidtimeout(org.elasticsearch.core.TimeValue timeout)booleantrackScores(boolean trackScores)booleanversion()voidversion(boolean version)Methods inherited from class org.elasticsearch.search.internal.FilteredSearchContext
addRescore, addSearchExt, aggregations, bitsetFilterCache, collapse, dfsResult, fetchPhase, getProfilers, getSearchExecutionContext, getSearchExt, getTask, groupStats, id, indexShard, innerHits, isCancelled, lowLevelCancellation, minimumScore, numberOfShards, parsedPostFilter, queryCollectors, readerContext, request, rescore, scrollContext, searchAfter, searchAfter, searcher, searchType, setTask, shardTarget, source, suggest, terminateAfter, timeout, trackTotalHitsUpTo, trackTotalHitsUpToMethods inherited from class org.elasticsearch.search.internal.SearchContext
addReleasable, assignRescoreDocIds, close, hasOnlySuggest, rescoreDocIds, toString
-
Constructor Details
-
SubSearchContext
-
-
Method Details
-
preProcess
public void preProcess(boolean rewrite)Description copied from class:SearchContextShould be called before executing the main query and after all other parameters have been set.- Overrides:
preProcessin classFilteredSearchContext- Parameters:
rewrite- if the set query should be rewritten against the searcher returned fromSearchContext.searcher()
-
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.- Overrides:
buildFilteredQueryin classFilteredSearchContext
-
aggregations
- Overrides:
aggregationsin classFilteredSearchContext
-
highlight
- Overrides:
highlightin classFilteredSearchContext
-
highlight
- Overrides:
highlightin classFilteredSearchContext
-
suggest
- Overrides:
suggestin classFilteredSearchContext
-
hasScriptFields
public boolean hasScriptFields()- Overrides:
hasScriptFieldsin classFilteredSearchContext
-
scriptFields
- Overrides:
scriptFieldsin classFilteredSearchContext
-
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.- Overrides:
sourceRequestedin classFilteredSearchContext
-
hasFetchSourceContext
public boolean hasFetchSourceContext()- Overrides:
hasFetchSourceContextin classFilteredSearchContext
-
fetchSourceContext
- Overrides:
fetchSourceContextin classFilteredSearchContext
-
fetchSourceContext
- Overrides:
fetchSourceContextin classFilteredSearchContext
-
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
-
timeout
public void timeout(org.elasticsearch.core.TimeValue timeout)- Overrides:
timeoutin classFilteredSearchContext
-
terminateAfter
public void terminateAfter(int terminateAfter)- Overrides:
terminateAfterin classFilteredSearchContext
-
minimumScore
- Overrides:
minimumScorein classFilteredSearchContext
-
sort
- Overrides:
sortin classFilteredSearchContext
-
sort
- Overrides:
sortin classFilteredSearchContext
-
parsedQuery
- Overrides:
parsedQueryin classFilteredSearchContext
-
parsedQuery
- Overrides:
parsedQueryin classFilteredSearchContext
-
query
public org.apache.lucene.search.Query query()Description copied from class:SearchContextThe query to execute, might be rewritten.- Overrides:
queryin classFilteredSearchContext
-
trackScores
- Overrides:
trackScoresin classFilteredSearchContext
-
trackScores
public boolean trackScores()- Overrides:
trackScoresin classFilteredSearchContext
-
parsedPostFilter
- Overrides:
parsedPostFilterin classFilteredSearchContext
-
from
public int from()- Overrides:
fromin classFilteredSearchContext
-
from
- Overrides:
fromin classFilteredSearchContext
-
size
public int size()- Overrides:
sizein classFilteredSearchContext
-
size
- Overrides:
sizein classFilteredSearchContext
-
hasStoredFields
public boolean hasStoredFields()- Overrides:
hasStoredFieldsin classFilteredSearchContext
-
storedFieldsContext
- Overrides:
storedFieldsContextin classFilteredSearchContext
-
storedFieldsContext
- Overrides:
storedFieldsContextin classFilteredSearchContext
-
explain
public boolean explain()- Overrides:
explainin classFilteredSearchContext
-
explain
public void explain(boolean explain)- Overrides:
explainin classFilteredSearchContext
-
groupStats
- Overrides:
groupStatsin classFilteredSearchContext
-
version
public boolean version()- Overrides:
versionin classFilteredSearchContext
-
version
public void version(boolean version)- Overrides:
versionin classFilteredSearchContext
-
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- Overrides:
seqNoAndPrimaryTermin classFilteredSearchContext
-
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- Overrides:
seqNoAndPrimaryTermin classFilteredSearchContext
-
docIdsToLoad
public int[] docIdsToLoad()- Overrides:
docIdsToLoadin classFilteredSearchContext
-
docIdsToLoadSize
public int docIdsToLoadSize()- Specified by:
docIdsToLoadSizein classSearchContext
-
docIdsToLoad
- Overrides:
docIdsToLoadin classFilteredSearchContext
-
collapse
- Overrides:
collapsein classFilteredSearchContext
-
queryResult
- Overrides:
queryResultin classFilteredSearchContext
-
fetchResult
- Overrides:
fetchResultin classFilteredSearchContext
-
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.- Overrides:
getRelativeTimeInMillisin classFilteredSearchContext
-