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
-
-
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()SearchExtBuildergetSearchExt(java.lang.String name)SearchTaskgetTask()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(SearchTask 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)org.apache.lucene.util.CountertimeEstimateCounter()TimeValuetimeout()voidtimeout(TimeValue timeout)booleantrackScores()SearchContexttrackScores(boolean trackScores)booleantrackTotalHits()Indicates if the total hit count for the query should be tracked.SearchContexttrackTotalHits(boolean trackTotalHits)booleanversion()voidversion(boolean version)-
Methods inherited from class org.elasticsearch.search.internal.SearchContext
addReleasable, alreadyClosed, clearReleasables, close, closeInternal, docValueFieldsContext, docValueFieldsContext, hasOnlySuggest, toString
-
-
-
-
Constructor Detail
-
FilteredSearchContext
public FilteredSearchContext(SearchContext in)
-
-
Method Detail
-
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
public StoredFieldsContext storedFieldsContext()
- Specified by:
storedFieldsContextin classSearchContext
-
storedFieldsContext
public SearchContext storedFieldsContext(StoredFieldsContext 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
public ShardSearchRequest request()
- Specified by:
requestin classSearchContext
-
searchType
public SearchType searchType()
- Specified by:
searchTypein classSearchContext
-
shardTarget
public SearchShardTarget 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
public ScrollContext scrollContext()
- Specified by:
scrollContextin classSearchContext
-
scrollContext
public SearchContext scrollContext(ScrollContext scroll)
- Specified by:
scrollContextin classSearchContext
-
aggregations
public SearchContextAggregations aggregations()
- Specified by:
aggregationsin classSearchContext
-
aggregations
public SearchContext aggregations(SearchContextAggregations aggregations)
- Specified by:
aggregationsin classSearchContext
-
highlight
public SearchContextHighlight highlight()
- Specified by:
highlightin classSearchContext
-
highlight
public void highlight(SearchContextHighlight highlight)
- Specified by:
highlightin classSearchContext
-
innerHits
public InnerHitsContext innerHits()
- Overrides:
innerHitsin classSearchContext
-
suggest
public SuggestionSearchContext suggest()
- Specified by:
suggestin classSearchContext
-
suggest
public void suggest(SuggestionSearchContext suggest)
- Specified by:
suggestin classSearchContext
-
rescore
public java.util.List<RescoreContext> rescore()
- Specified by:
rescorein classSearchContext- Returns:
- list of all rescore contexts. empty if there aren't any.
-
addRescore
public void addRescore(RescoreContext rescore)
- Specified by:
addRescorein classSearchContext
-
hasScriptFields
public boolean hasScriptFields()
- Specified by:
hasScriptFieldsin classSearchContext
-
scriptFields
public ScriptFieldsContext 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
public FetchSourceContext fetchSourceContext()
- Specified by:
fetchSourceContextin classSearchContext
-
fetchSourceContext
public SearchContext fetchSourceContext(FetchSourceContext fetchSourceContext)
- Specified by:
fetchSourceContextin classSearchContext
-
searcher
public ContextIndexSearcher searcher()
- Specified by:
searcherin classSearchContext
-
indexShard
public IndexShard indexShard()
- Specified by:
indexShardin classSearchContext
-
mapperService
public MapperService mapperService()
- Specified by:
mapperServicein classSearchContext
-
similarityService
public SimilarityService similarityService()
- Specified by:
similarityServicein classSearchContext
-
bigArrays
public BigArrays bigArrays()
- Specified by:
bigArraysin classSearchContext
-
bitsetFilterCache
public BitsetFilterCache bitsetFilterCache()
- Specified by:
bitsetFilterCachein classSearchContext
-
getForField
public <IFD extends IndexFieldData<?>> IFD getForField(MappedFieldType fieldType)
- Specified by:
getForFieldin classSearchContext
-
timeout
public TimeValue timeout()
- Specified by:
timeoutin classSearchContext
-
timeout
public void timeout(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
public SearchContext minimumScore(float minimumScore)
- Specified by:
minimumScorein classSearchContext
-
minimumScore
public java.lang.Float minimumScore()
- Specified by:
minimumScorein classSearchContext
-
sort
public SearchContext sort(SortAndFormats sort)
- Specified by:
sortin classSearchContext
-
sort
public SortAndFormats sort()
- Specified by:
sortin classSearchContext
-
trackScores
public SearchContext trackScores(boolean trackScores)
- Specified by:
trackScoresin classSearchContext
-
trackScores
public boolean trackScores()
- Specified by:
trackScoresin classSearchContext
-
trackTotalHits
public SearchContext trackTotalHits(boolean trackTotalHits)
- Specified by:
trackTotalHitsin classSearchContext
-
trackTotalHits
public boolean trackTotalHits()
Description copied from class:SearchContextIndicates if the total hit count for the query should be tracked. Defaults totrue- Specified by:
trackTotalHitsin classSearchContext
-
searchAfter
public SearchContext searchAfter(org.apache.lucene.search.FieldDoc searchAfter)
- Specified by:
searchAfterin classSearchContext
-
searchAfter
public org.apache.lucene.search.FieldDoc searchAfter()
- Specified by:
searchAfterin classSearchContext
-
parsedPostFilter
public SearchContext parsedPostFilter(ParsedQuery postFilter)
- Specified by:
parsedPostFilterin classSearchContext
-
parsedPostFilter
public ParsedQuery parsedPostFilter()
- Specified by:
parsedPostFilterin classSearchContext
-
aliasFilter
public org.apache.lucene.search.Query aliasFilter()
- Specified by:
aliasFilterin classSearchContext
-
parsedQuery
public SearchContext parsedQuery(ParsedQuery query)
- Specified by:
parsedQueryin classSearchContext
-
parsedQuery
public ParsedQuery 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
public SearchContext from(int from)
- Specified by:
fromin classSearchContext
-
size
public int size()
- Specified by:
sizein classSearchContext
-
size
public SearchContext size(int 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
public SearchLookup lookup()
- Overrides:
lookupin classSearchContext
-
dfsResult
public DfsSearchResult dfsResult()
- Specified by:
dfsResultin classSearchContext
-
queryResult
public QuerySearchResult queryResult()
- Specified by:
queryResultin classSearchContext
-
fetchResult
public FetchSearchResult fetchResult()
- Specified by:
fetchResultin classSearchContext
-
fetchPhase
public FetchPhase fetchPhase()
- Specified by:
fetchPhasein classSearchContext
-
smartNameFieldType
public MappedFieldType smartNameFieldType(java.lang.String name)
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
public ObjectMapper getObjectMapper(java.lang.String name)
- Specified by:
getObjectMapperin classSearchContext
-
timeEstimateCounter
public org.apache.lucene.util.Counter timeEstimateCounter()
- Specified by:
timeEstimateCounterin classSearchContext
-
addSearchExt
public void addSearchExt(SearchExtBuilder searchExtBuilder)
- Specified by:
addSearchExtin classSearchContext
-
getSearchExt
public SearchExtBuilder getSearchExt(java.lang.String name)
- Specified by:
getSearchExtin classSearchContext
-
getProfilers
public Profilers 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
public QueryShardContext getQueryShardContext()
- Specified by:
getQueryShardContextin classSearchContext
-
setTask
public void setTask(SearchTask task)
- Specified by:
setTaskin classSearchContext
-
getTask
public SearchTask getTask()
- Specified by:
getTaskin classSearchContext
-
isCancelled
public boolean isCancelled()
- Specified by:
isCancelledin classSearchContext
-
collapse
public SearchContext collapse(CollapseContext collapse)
- Specified by:
collapsein classSearchContext
-
collapse
public CollapseContext collapse()
- Specified by:
collapsein classSearchContext
-
-