Class FilteredSearchContext
java.lang.Object
org.elasticsearch.common.util.concurrent.AbstractRefCounted
org.elasticsearch.search.internal.SearchContext
org.elasticsearch.search.internal.FilteredSearchContext
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,Releasable,RefCounted
- Direct Known Subclasses:
SubSearchContext
public abstract class FilteredSearchContext extends SearchContext
-
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 FilteredSearchContext(SearchContext in) -
Method Summary
Modifier and Type Method Description voidaccessed(long accessTime)voidaddRescore(RescoreContext rescore)voidaddSearchExt(SearchExtBuilder searchExtBuilder)SearchContextAggregationsaggregations()SearchContextaggregations(SearchContextAggregations aggregations)org.apache.lucene.search.QueryaliasFilter()BigArraysbigArrays()BitsetFilterCachebitsetFilterCache()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()SearchContextcollapse(CollapseContext collapse)DfsSearchResultdfsResult()int[]docIdsToLoad()SearchContextdocIdsToLoad(int[] docIdsToLoad, int docsIdsToLoadFrom, int docsIdsToLoadSize)intdocIdsToLoadFrom()intdocIdsToLoadSize()protected voiddoClose()booleanexplain()voidexplain(boolean explain)FetchPhasefetchPhase()FetchSearchResultfetchResult()FetchSourceContextfetchSourceContext()SearchContextfetchSourceContext(FetchSourceContext fetchSourceContext)intfrom()SearchContextfrom(int from)<IFD extends IndexFieldData<?>>
IFDgetForField(MappedFieldType fieldType)ObjectMappergetObjectMapper(java.lang.String name)longgetOriginNanoTime()ProfilersgetProfilers()Return a handle over the profilers for the current search request, ornullif profiling is not enabled.QueryShardContextgetQueryShardContext()longgetRelativeTimeInMillis()Returns time in milliseconds that can be used for relative time calculations.SearchExtBuildergetSearchExt(java.lang.String name)SearchShardTaskgetTask()java.util.List<java.lang.String>groupStats()voidgroupStats(java.util.List<java.lang.String> groupStats)booleanhasFetchSourceContext()booleanhasScriptFields()booleanhasStoredFields()booleanhasStoredFieldsContext()SearchContextHighlighthighlight()voidhighlight(SearchContextHighlight highlight)longid()IndexShardindexShard()InnerHitsContextinnerHits()booleanisCancelled()longkeepAlive()voidkeepAlive(long keepAlive)longlastAccessTime()SearchLookuplookup()booleanlowLevelCancellation()Indicates if the current index should perform frequent low level search cancellation check.MapperServicemapperService()java.lang.FloatminimumScore()SearchContextminimumScore(float minimumScore)intnumberOfShards()ParsedQueryparsedPostFilter()SearchContextparsedPostFilter(ParsedQuery postFilter)ParsedQueryparsedQuery()SearchContextparsedQuery(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.floatqueryBoost()java.util.Map<java.lang.Class<?>,org.apache.lucene.search.Collector>queryCollectors()Return a view of the additional query collectors that should be run for this context.QuerySearchResultqueryResult()ShardSearchRequestrequest()java.util.List<RescoreContext>rescore()ScriptFieldsContextscriptFields()ScrollContextscrollContext()SearchContextscrollContext(ScrollContext scroll)org.apache.lucene.search.FieldDocsearchAfter()SearchContextsearchAfter(org.apache.lucene.search.FieldDoc searchAfter)ContextIndexSearchersearcher()SearchTypesearchType()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 returnedvoidsetTask(SearchShardTask task)SearchShardTargetshardTarget()SimilarityServicesimilarityService()intsize()SearchContextsize(int size)MappedFieldTypesmartNameFieldType(java.lang.String name)Looks up the given field, but does not restrict to fields in the types set on this context.SortAndFormatssort()SearchContextsort(SortAndFormats sort)java.lang.Stringsource()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.SuggestionSearchContextsuggest()voidsuggest(SuggestionSearchContext suggest)intterminateAfter()voidterminateAfter(int terminateAfter)TimeValuetimeout()voidtimeout(TimeValue timeout)booleantrackScores()SearchContexttrackScores(boolean trackScores)inttrackTotalHitsUpTo()Indicates the total number of hits to count accurately.SearchContexttrackTotalHitsUpTo(int trackTotalHitsUpTo)booleanversion()voidversion(boolean version)Methods inherited from class org.elasticsearch.search.internal.SearchContext
addReleasable, alreadyClosed, clearReleasables, close, closeInternal, docValuesContext, docValuesContext, hasOnlySuggest, toString
-
Constructor Details
-
Method Details
-
hasStoredFields
public boolean hasStoredFields()- Specified by:
hasStoredFieldsin classSearchContext
-
hasStoredFieldsContext
public boolean hasStoredFieldsContext()- Specified by:
hasStoredFieldsContextin classSearchContext
-
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.- Specified by:
storedFieldsRequestedin classSearchContext
-
storedFieldsContext
- Specified by:
storedFieldsContextin classSearchContext
-
storedFieldsContext
- Specified by:
storedFieldsContextin classSearchContext
-
doClose
protected void doClose()- Specified by:
doClosein 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
public long id()- Specified by:
idin classSearchContext
-
source
public java.lang.String 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
-
queryBoost
public float queryBoost()- Specified by:
queryBoostin classSearchContext
-
getOriginNanoTime
public long getOriginNanoTime()- Specified by:
getOriginNanoTimein classSearchContext
-
scrollContext
- Specified by:
scrollContextin 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.
-
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
-
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
-
mapperService
- Specified by:
mapperServicein classSearchContext
-
similarityService
- Specified by:
similarityServicein classSearchContext
-
bigArrays
- Specified by:
bigArraysin classSearchContext
-
bitsetFilterCache
- Specified by:
bitsetFilterCachein classSearchContext
-
getForField
- Specified by:
getForFieldin classSearchContext
-
timeout
- Specified by:
timeoutin classSearchContext
-
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
public java.lang.Float 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
-
aliasFilter
public org.apache.lucene.search.Query aliasFilter()- Specified by:
aliasFilterin 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
public java.util.List<java.lang.String> groupStats()- Specified by:
groupStatsin classSearchContext
-
groupStats
public void groupStats(java.util.List<java.lang.String> 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
-
docIdsToLoadFrom
public int docIdsToLoadFrom()- Specified by:
docIdsToLoadFromin classSearchContext
-
docIdsToLoadSize
public int docIdsToLoadSize()- Specified by:
docIdsToLoadSizein classSearchContext
-
docIdsToLoad
public SearchContext docIdsToLoad(int[] docIdsToLoad, int docsIdsToLoadFrom, int docsIdsToLoadSize)- Specified by:
docIdsToLoadin classSearchContext
-
accessed
public void accessed(long accessTime)- Specified by:
accessedin classSearchContext
-
lastAccessTime
public long lastAccessTime()- Specified by:
lastAccessTimein classSearchContext
-
keepAlive
public long keepAlive()- Specified by:
keepAlivein classSearchContext
-
keepAlive
public void keepAlive(long keepAlive)- Specified by:
keepAlivein classSearchContext
-
lookup
- Overrides:
lookupin classSearchContext
-
dfsResult
- Specified by:
dfsResultin classSearchContext
-
queryResult
- Specified by:
queryResultin classSearchContext
-
fetchResult
- Specified by:
fetchResultin classSearchContext
-
fetchPhase
- Specified by:
fetchPhasein classSearchContext
-
smartNameFieldType
Description copied from class:SearchContextLooks up the given field, but does not restrict to fields in the types set on this context.- Specified by:
smartNameFieldTypein classSearchContext
-
getObjectMapper
- Specified by:
getObjectMapperin 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
public java.util.Map<java.lang.Class<?>,org.apache.lucene.search.Collector> queryCollectors()Description copied from class:SearchContextReturn a view of the additional query collectors that should be run for this context.- Specified by:
queryCollectorsin classSearchContext
-
getQueryShardContext
- Specified by:
getQueryShardContextin 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
-