Class SubSearchContext
java.lang.Object
org.elasticsearch.common.util.concurrent.AbstractRefCounted
org.elasticsearch.search.internal.SearchContext
org.elasticsearch.search.internal.FilteredSearchContext
org.elasticsearch.search.internal.SubSearchContext
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,Releasable,RefCounted
- Direct Known Subclasses:
InnerHitsContext.InnerHitSubContext
public class SubSearchContext extends FilteredSearchContext
-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.search.internal.SearchContext
SearchContext.Lifetime -
Field Summary
Fields inherited from class org.elasticsearch.search.internal.SearchContext
DEFAULT_TERMINATE_AFTER, DEFAULT_TRACK_TOTAL_HITS_UP_TO, TRACK_TOTAL_HITS_ACCURATE, TRACK_TOTAL_HITS_DISABLED -
Constructor Summary
Constructors Constructor Description SubSearchContext(SearchContext context) -
Method Summary
Modifier and Type Method Description voidaccessed(long accessTime)voidaddRescore(RescoreContext rescore)SearchContextaggregations(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.CollapseContextcollapse()int[]docIdsToLoad()SearchContextdocIdsToLoad(int[] docIdsToLoad, int docsIdsToLoadFrom, int docsIdsToLoadSize)intdocIdsToLoadFrom()intdocIdsToLoadSize()protected voiddoClose()FetchDocValuesContextdocValuesContext()SearchContextdocValuesContext(FetchDocValuesContext docValuesContext)booleanexplain()voidexplain(boolean explain)FetchSearchResultfetchResult()FetchSourceContextfetchSourceContext()SearchContextfetchSourceContext(FetchSourceContext fetchSourceContext)intfrom()SearchContextfrom(int from)longgetRelativeTimeInMillis()Returns time in milliseconds that can be used for relative time calculations.voidgroupStats(java.util.List<java.lang.String> groupStats)booleanhasFetchSourceContext()booleanhasScriptFields()booleanhasStoredFields()booleanhasStoredFieldsContext()SearchContextHighlighthighlight()voidhighlight(SearchContextHighlight highlight)voidkeepAlive(long keepAlive)SearchContextminimumScore(float minimumScore)SearchContextparsedPostFilter(ParsedQuery postFilter)ParsedQueryparsedQuery()SearchContextparsedQuery(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.QuerySearchResultqueryResult()ScriptFieldsContextscriptFields()SearchContextscrollContext(ScrollContext scrollContext)booleanseqNoAndPrimaryTerm()indicates 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()SearchContextsize(int size)SortAndFormatssort()SearchContextsort(SortAndFormats sort)booleansourceRequested()A shortcut function to see whether there is a fetchSourceContext and it says the source is requested.StoredFieldsContextstoredFieldsContext()SearchContextstoredFieldsContext(StoredFieldsContext storedFieldsContext)booleanstoredFieldsRequested()A shortcut function to see whether there is a storedFieldsContext and it says the fields are requested.voidsuggest(SuggestionSearchContext suggest)voidterminateAfter(int terminateAfter)voidtimeout(TimeValue timeout)booleantrackScores()SearchContexttrackScores(boolean trackScores)booleanversion()voidversion(boolean version)Methods inherited from class org.elasticsearch.search.internal.FilteredSearchContext
addSearchExt, aggregations, aliasFilter, bigArrays, bitsetFilterCache, collapse, dfsResult, fetchPhase, getForField, getObjectMapper, getOriginNanoTime, getProfilers, getQueryShardContext, getSearchExt, getTask, groupStats, id, indexShard, innerHits, isCancelled, keepAlive, lastAccessTime, lookup, lowLevelCancellation, mapperService, minimumScore, numberOfShards, parsedPostFilter, queryBoost, queryCollectors, request, rescore, scrollContext, searchAfter, searchAfter, searcher, searchType, setTask, shardTarget, similarityService, smartNameFieldType, source, suggest, terminateAfter, timeout, trackTotalHitsUpTo, trackTotalHitsUpToMethods inherited from class org.elasticsearch.search.internal.SearchContext
addReleasable, alreadyClosed, clearReleasables, close, closeInternal, hasOnlySuggest, toString
-
Constructor Details
-
Method Details
-
doClose
protected void doClose()- Overrides:
doClosein classFilteredSearchContext
-
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
-
scrollContext
- Overrides:
scrollContextin classFilteredSearchContext
-
aggregations
- Overrides:
aggregationsin classFilteredSearchContext
-
highlight
- Overrides:
highlightin classFilteredSearchContext
-
highlight
- Overrides:
highlightin classFilteredSearchContext
-
suggest
- Overrides:
suggestin classFilteredSearchContext
-
addRescore
- Overrides:
addRescorein 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
-
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
-
hasStoredFieldsContext
public boolean hasStoredFieldsContext()- Overrides:
hasStoredFieldsContextin classFilteredSearchContext
-
storedFieldsRequested
public boolean storedFieldsRequested()Description copied from class:SearchContextA shortcut function to see whether there is a storedFieldsContext and it says the fields are requested.- Overrides:
storedFieldsRequestedin 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
public void groupStats(java.util.List<java.lang.String> 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
-
docIdsToLoadFrom
public int docIdsToLoadFrom()- Overrides:
docIdsToLoadFromin classFilteredSearchContext
-
docIdsToLoadSize
public int docIdsToLoadSize()- Overrides:
docIdsToLoadSizein classFilteredSearchContext
-
docIdsToLoad
public SearchContext docIdsToLoad(int[] docIdsToLoad, int docsIdsToLoadFrom, int docsIdsToLoadSize)- Overrides:
docIdsToLoadin classFilteredSearchContext
-
collapse
- Overrides:
collapsein classFilteredSearchContext
-
accessed
public void accessed(long accessTime)- Overrides:
accessedin classFilteredSearchContext
-
keepAlive
public void keepAlive(long keepAlive)- Overrides:
keepAlivein 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
-