Class FilteredSearchContext
java.lang.Object
org.elasticsearch.search.internal.SearchContext
org.elasticsearch.search.internal.FilteredSearchContext
- All Implemented Interfaces:
Closeable,AutoCloseable,org.elasticsearch.core.Releasable
- Direct Known Subclasses:
SubSearchContext
-
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 TypeMethodDescriptionvoidaddRescore(RescoreContext rescore)voidaddSearchExt(SearchExtBuilder searchExtBuilder)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(CollapseContext collapse)int[]docIdsToLoad(int[] docIdsToLoad, int docsIdsToLoadSize)booleanexplain()voidexplain(boolean explain)fetchSourceContext(FetchSourceContext fetchSourceContext)intfrom()from(int from)Return a handle over the profilers for the current search request, ornullif profiling is not enabled.longReturns time in milliseconds that can be used for relative time calculations.getSearchExt(String name)getTask()voidgroupStats(List<String> groupStats)booleanbooleanbooleanvoidhighlight(SearchHighlightContext highlight)id()booleanbooleanIndicates if the current index should perform frequent low level search cancellation check.minimumScore(float minimumScore)intparsedPostFilter(ParsedQuery postFilter)parsedQuery(ParsedQuery query)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.Return a view of the additional query collectors that should be run for this context.request()rescore()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(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)org.elasticsearch.core.TimeValuetimeout()voidtimeout(org.elasticsearch.core.TimeValue timeout)booleantrackScores(boolean trackScores)intIndicates the total number of hits to count accurately.trackTotalHitsUpTo(int trackTotalHitsUpTo)booleanversion()voidversion(boolean version)Methods inherited from class org.elasticsearch.search.internal.SearchContext
addReleasable, assignRescoreDocIds, close, docIdsToLoadSize, docValuesContext, docValuesContext, fetchFieldsContext, fetchFieldsContext, hasOnlySuggest, rescoreDocIds, toString
-
Constructor Details
-
FilteredSearchContext
-
-
Method Details
-
hasStoredFields
public boolean hasStoredFields()- Specified by:
hasStoredFieldsin classSearchContext
-
storedFieldsContext
- Specified by:
storedFieldsContextin classSearchContext
-
storedFieldsContext
- Specified by:
storedFieldsContextin classSearchContext
-
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.- Specified by:
preProcessin classSearchContext- 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.- Specified by:
buildFilteredQueryin classSearchContext
-
id
- Specified by:
idin classSearchContext
-
source
- Specified by:
sourcein classSearchContext
-
request
- Specified by:
requestin classSearchContext
-
searchType
- Specified by:
searchTypein classSearchContext
-
shardTarget
- Specified by:
shardTargetin classSearchContext
-
numberOfShards
public int numberOfShards()- Specified by:
numberOfShardsin classSearchContext
-
scrollContext
- Specified by:
scrollContextin classSearchContext
-
aggregations
- Specified by:
aggregationsin classSearchContext
-
aggregations
- Specified by:
aggregationsin classSearchContext
-
highlight
- Specified by:
highlightin classSearchContext
-
highlight
- Specified by:
highlightin classSearchContext
-
innerHits
- Overrides:
innerHitsin classSearchContext
-
suggest
- Specified by:
suggestin classSearchContext
-
suggest
- Specified by:
suggestin classSearchContext
-
rescore
- Specified by:
rescorein classSearchContext- Returns:
- list of all rescore contexts. empty if there aren't any.
-
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
-
hasFetchSourceContext
public boolean hasFetchSourceContext()- Specified by:
hasFetchSourceContextin classSearchContext
-
fetchSourceContext
- Specified by:
fetchSourceContextin classSearchContext
-
fetchSourceContext
- Specified by:
fetchSourceContextin classSearchContext
-
searcher
- Specified by:
searcherin classSearchContext
-
indexShard
- Specified by:
indexShardin classSearchContext
-
bitsetFilterCache
- Specified by:
bitsetFilterCachein classSearchContext
-
timeout
public org.elasticsearch.core.TimeValue timeout()- Specified by:
timeoutin classSearchContext
-
timeout
public void timeout(org.elasticsearch.core.TimeValue timeout)- Specified by:
timeoutin classSearchContext
-
terminateAfter
public int terminateAfter()- Specified by:
terminateAfterin 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
-
minimumScore
- Specified by:
minimumScorein classSearchContext
-
sort
- Specified by:
sortin classSearchContext
-
sort
- Specified by:
sortin classSearchContext
-
trackScores
- Specified by:
trackScoresin classSearchContext
-
trackScores
public boolean trackScores()- Specified by:
trackScoresin classSearchContext
-
trackTotalHitsUpTo
- Specified by:
trackTotalHitsUpToin classSearchContext
-
trackTotalHitsUpTo
public int trackTotalHitsUpTo()Description copied from class:SearchContextIndicates the total number of hits to count accurately. Defaults toSearchContext.DEFAULT_TRACK_TOTAL_HITS_UP_TO.- Specified by:
trackTotalHitsUpToin classSearchContext
-
searchAfter
- Specified by:
searchAfterin classSearchContext
-
searchAfter
public org.apache.lucene.search.FieldDoc searchAfter()- Specified by:
searchAfterin classSearchContext
-
parsedPostFilter
- Specified by:
parsedPostFilterin classSearchContext
-
parsedPostFilter
- Specified by:
parsedPostFilterin classSearchContext
-
parsedQuery
- Specified by:
parsedQueryin classSearchContext
-
parsedQuery
- Specified by:
parsedQueryin classSearchContext
-
query
public org.apache.lucene.search.Query query()Description copied from class:SearchContextThe query to execute, might be rewritten.- Specified by:
queryin classSearchContext
-
from
public int from()- Specified by:
fromin classSearchContext
-
from
- Specified by:
fromin classSearchContext
-
size
public int size()- Specified by:
sizein classSearchContext
-
size
- Specified by:
sizein classSearchContext
-
explain
public boolean explain()- Specified by:
explainin classSearchContext
-
explain
public void explain(boolean explain)- Specified by:
explainin classSearchContext
-
groupStats
- Specified by:
groupStatsin 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
-
docIdsToLoad
public int[] docIdsToLoad()- Specified by:
docIdsToLoadin classSearchContext
-
docIdsToLoad
- Specified by:
docIdsToLoadin classSearchContext
-
dfsResult
- Specified by:
dfsResultin classSearchContext
-
queryResult
- Specified by:
queryResultin classSearchContext
-
fetchResult
- Specified by:
fetchResultin classSearchContext
-
fetchPhase
- Specified by:
fetchPhasein 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
-
addSearchExt
- Specified by:
addSearchExtin classSearchContext
-
getSearchExt
- Specified by:
getSearchExtin classSearchContext
-
getProfilers
Description copied from class:SearchContextReturn a handle over the profilers for the current search request, ornullif profiling is not enabled.- Specified by:
getProfilersin classSearchContext
-
queryCollectors
Description copied from class:SearchContextReturn a view of the additional query collectors that should be run for this context.- Specified by:
queryCollectorsin classSearchContext
-
getSearchExecutionContext
- Specified by:
getSearchExecutionContextin classSearchContext
-
setTask
- Specified by:
setTaskin classSearchContext
-
getTask
- Specified by:
getTaskin classSearchContext
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin classSearchContext
-
collapse
- Specified by:
collapsein classSearchContext
-
collapse
- Specified by:
collapsein classSearchContext
-
addRescore
- Specified by:
addRescorein classSearchContext
-
readerContext
- Specified by:
readerContextin classSearchContext
-