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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accessed(long accessTime)
void
addRescore(RescoreContext rescore)
void
addSearchExt(SearchExtBuilder searchExtBuilder)
SearchContextAggregations
aggregations()
SearchContext
aggregations(SearchContextAggregations aggregations)
org.apache.lucene.search.Query
aliasFilter()
BigArrays
bigArrays()
BitsetFilterCache
bitsetFilterCache()
org.apache.lucene.search.Query
buildFilteredQuery(org.apache.lucene.search.Query query)
Automatically apply all required filters to the given query such as alias filters, types filters, etc.CollapseContext
collapse()
SearchContext
collapse(CollapseContext collapse)
DfsSearchResult
dfsResult()
int[]
docIdsToLoad()
SearchContext
docIdsToLoad(int[] docIdsToLoad, int docsIdsToLoadFrom, int docsIdsToLoadSize)
int
docIdsToLoadFrom()
int
docIdsToLoadSize()
protected void
doClose()
boolean
explain()
void
explain(boolean explain)
FetchPhase
fetchPhase()
FetchSearchResult
fetchResult()
FetchSourceContext
fetchSourceContext()
SearchContext
fetchSourceContext(FetchSourceContext fetchSourceContext)
int
from()
SearchContext
from(int from)
<IFD extends IndexFieldData<?>>
IFDgetForField(MappedFieldType fieldType)
ObjectMapper
getObjectMapper(java.lang.String name)
long
getOriginNanoTime()
Profilers
getProfilers()
Return a handle over the profilers for the current search request, ornull
if profiling is not enabled.QueryShardContext
getQueryShardContext()
SearchExtBuilder
getSearchExt(java.lang.String name)
SearchTask
getTask()
java.util.List<java.lang.String>
groupStats()
void
groupStats(java.util.List<java.lang.String> groupStats)
boolean
hasFetchSourceContext()
boolean
hasScriptFields()
boolean
hasStoredFields()
boolean
hasStoredFieldsContext()
SearchContextHighlight
highlight()
void
highlight(SearchContextHighlight highlight)
long
id()
IndexShard
indexShard()
InnerHitsContext
innerHits()
boolean
isCancelled()
long
keepAlive()
void
keepAlive(long keepAlive)
long
lastAccessTime()
SearchLookup
lookup()
boolean
lowLevelCancellation()
Indicates if the current index should perform frequent low level search cancellation check.MapperService
mapperService()
java.lang.Float
minimumScore()
SearchContext
minimumScore(float minimumScore)
int
numberOfShards()
ParsedQuery
parsedPostFilter()
SearchContext
parsedPostFilter(ParsedQuery postFilter)
ParsedQuery
parsedQuery()
SearchContext
parsedQuery(ParsedQuery query)
void
preProcess(boolean rewrite)
Should be called before executing the main query and after all other parameters have been set.org.apache.lucene.search.Query
query()
The query to execute, might be rewritten.float
queryBoost()
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.QuerySearchResult
queryResult()
ShardSearchRequest
request()
java.util.List<RescoreContext>
rescore()
ScriptFieldsContext
scriptFields()
ScrollContext
scrollContext()
SearchContext
scrollContext(ScrollContext scroll)
org.apache.lucene.search.FieldDoc
searchAfter()
SearchContext
searchAfter(org.apache.lucene.search.FieldDoc searchAfter)
ContextIndexSearcher
searcher()
SearchType
searchType()
void
setTask(SearchTask task)
SearchShardTarget
shardTarget()
SimilarityService
similarityService()
int
size()
SearchContext
size(int size)
MappedFieldType
smartNameFieldType(java.lang.String name)
Looks up the given field, but does not restrict to fields in the types set on this context.SortAndFormats
sort()
SearchContext
sort(SortAndFormats sort)
java.lang.String
source()
boolean
sourceRequested()
A shortcut function to see whether there is a fetchSourceContext and it says the source is requested.StoredFieldsContext
storedFieldsContext()
SearchContext
storedFieldsContext(StoredFieldsContext storedFieldsContext)
boolean
storedFieldsRequested()
A shortcut function to see whether there is a storedFieldsContext and it says the fields are requested.SuggestionSearchContext
suggest()
void
suggest(SuggestionSearchContext suggest)
int
terminateAfter()
void
terminateAfter(int terminateAfter)
org.apache.lucene.util.Counter
timeEstimateCounter()
TimeValue
timeout()
void
timeout(TimeValue timeout)
boolean
trackScores()
SearchContext
trackScores(boolean trackScores)
boolean
trackTotalHits()
Indicates if the total hit count for the query should be tracked.SearchContext
trackTotalHits(boolean trackTotalHits)
boolean
version()
void
version(boolean version)
-
Methods inherited from class org.elasticsearch.common.util.concurrent.AbstractRefCounted
decRef, getName, incRef, refCount, tryIncRef
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
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:
hasStoredFields
in classSearchContext
-
hasStoredFieldsContext
public boolean hasStoredFieldsContext()
- Specified by:
hasStoredFieldsContext
in classSearchContext
-
storedFieldsRequested
public boolean storedFieldsRequested()
Description copied from class:SearchContext
A shortcut function to see whether there is a storedFieldsContext and it says the fields are requested.- Specified by:
storedFieldsRequested
in classSearchContext
-
storedFieldsContext
public StoredFieldsContext storedFieldsContext()
- Specified by:
storedFieldsContext
in classSearchContext
-
storedFieldsContext
public SearchContext storedFieldsContext(StoredFieldsContext storedFieldsContext)
- Specified by:
storedFieldsContext
in classSearchContext
-
doClose
protected void doClose()
- Specified by:
doClose
in classSearchContext
-
preProcess
public void preProcess(boolean rewrite)
Description copied from class:SearchContext
Should be called before executing the main query and after all other parameters have been set.- Specified by:
preProcess
in 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:SearchContext
Automatically apply all required filters to the given query such as alias filters, types filters, etc.- Specified by:
buildFilteredQuery
in classSearchContext
-
id
public long id()
- Specified by:
id
in classSearchContext
-
source
public java.lang.String source()
- Specified by:
source
in classSearchContext
-
request
public ShardSearchRequest request()
- Specified by:
request
in classSearchContext
-
searchType
public SearchType searchType()
- Specified by:
searchType
in classSearchContext
-
shardTarget
public SearchShardTarget shardTarget()
- Specified by:
shardTarget
in classSearchContext
-
numberOfShards
public int numberOfShards()
- Specified by:
numberOfShards
in classSearchContext
-
queryBoost
public float queryBoost()
- Specified by:
queryBoost
in classSearchContext
-
getOriginNanoTime
public long getOriginNanoTime()
- Specified by:
getOriginNanoTime
in classSearchContext
-
scrollContext
public ScrollContext scrollContext()
- Specified by:
scrollContext
in classSearchContext
-
scrollContext
public SearchContext scrollContext(ScrollContext scroll)
- Specified by:
scrollContext
in classSearchContext
-
aggregations
public SearchContextAggregations aggregations()
- Specified by:
aggregations
in classSearchContext
-
aggregations
public SearchContext aggregations(SearchContextAggregations aggregations)
- Specified by:
aggregations
in classSearchContext
-
highlight
public SearchContextHighlight highlight()
- Specified by:
highlight
in classSearchContext
-
highlight
public void highlight(SearchContextHighlight highlight)
- Specified by:
highlight
in classSearchContext
-
innerHits
public InnerHitsContext innerHits()
- Overrides:
innerHits
in classSearchContext
-
suggest
public SuggestionSearchContext suggest()
- Specified by:
suggest
in classSearchContext
-
suggest
public void suggest(SuggestionSearchContext suggest)
- Specified by:
suggest
in classSearchContext
-
rescore
public java.util.List<RescoreContext> rescore()
- Specified by:
rescore
in classSearchContext
- Returns:
- list of all rescore contexts. empty if there aren't any.
-
addRescore
public void addRescore(RescoreContext rescore)
- Specified by:
addRescore
in classSearchContext
-
hasScriptFields
public boolean hasScriptFields()
- Specified by:
hasScriptFields
in classSearchContext
-
scriptFields
public ScriptFieldsContext scriptFields()
- Specified by:
scriptFields
in classSearchContext
-
sourceRequested
public boolean sourceRequested()
Description copied from class:SearchContext
A shortcut function to see whether there is a fetchSourceContext and it says the source is requested.- Specified by:
sourceRequested
in classSearchContext
-
hasFetchSourceContext
public boolean hasFetchSourceContext()
- Specified by:
hasFetchSourceContext
in classSearchContext
-
fetchSourceContext
public FetchSourceContext fetchSourceContext()
- Specified by:
fetchSourceContext
in classSearchContext
-
fetchSourceContext
public SearchContext fetchSourceContext(FetchSourceContext fetchSourceContext)
- Specified by:
fetchSourceContext
in classSearchContext
-
searcher
public ContextIndexSearcher searcher()
- Specified by:
searcher
in classSearchContext
-
indexShard
public IndexShard indexShard()
- Specified by:
indexShard
in classSearchContext
-
mapperService
public MapperService mapperService()
- Specified by:
mapperService
in classSearchContext
-
similarityService
public SimilarityService similarityService()
- Specified by:
similarityService
in classSearchContext
-
bigArrays
public BigArrays bigArrays()
- Specified by:
bigArrays
in classSearchContext
-
bitsetFilterCache
public BitsetFilterCache bitsetFilterCache()
- Specified by:
bitsetFilterCache
in classSearchContext
-
getForField
public <IFD extends IndexFieldData<?>> IFD getForField(MappedFieldType fieldType)
- Specified by:
getForField
in classSearchContext
-
timeout
public TimeValue timeout()
- Specified by:
timeout
in classSearchContext
-
timeout
public void timeout(TimeValue timeout)
- Specified by:
timeout
in classSearchContext
-
terminateAfter
public int terminateAfter()
- Specified by:
terminateAfter
in classSearchContext
-
terminateAfter
public void terminateAfter(int terminateAfter)
- Specified by:
terminateAfter
in classSearchContext
-
lowLevelCancellation
public boolean lowLevelCancellation()
Description copied from class:SearchContext
Indicates 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:
lowLevelCancellation
in classSearchContext
-
minimumScore
public SearchContext minimumScore(float minimumScore)
- Specified by:
minimumScore
in classSearchContext
-
minimumScore
public java.lang.Float minimumScore()
- Specified by:
minimumScore
in classSearchContext
-
sort
public SearchContext sort(SortAndFormats sort)
- Specified by:
sort
in classSearchContext
-
sort
public SortAndFormats sort()
- Specified by:
sort
in classSearchContext
-
trackScores
public SearchContext trackScores(boolean trackScores)
- Specified by:
trackScores
in classSearchContext
-
trackScores
public boolean trackScores()
- Specified by:
trackScores
in classSearchContext
-
trackTotalHits
public SearchContext trackTotalHits(boolean trackTotalHits)
- Specified by:
trackTotalHits
in classSearchContext
-
trackTotalHits
public boolean trackTotalHits()
Description copied from class:SearchContext
Indicates if the total hit count for the query should be tracked. Defaults totrue
- Specified by:
trackTotalHits
in classSearchContext
-
searchAfter
public SearchContext searchAfter(org.apache.lucene.search.FieldDoc searchAfter)
- Specified by:
searchAfter
in classSearchContext
-
searchAfter
public org.apache.lucene.search.FieldDoc searchAfter()
- Specified by:
searchAfter
in classSearchContext
-
parsedPostFilter
public SearchContext parsedPostFilter(ParsedQuery postFilter)
- Specified by:
parsedPostFilter
in classSearchContext
-
parsedPostFilter
public ParsedQuery parsedPostFilter()
- Specified by:
parsedPostFilter
in classSearchContext
-
aliasFilter
public org.apache.lucene.search.Query aliasFilter()
- Specified by:
aliasFilter
in classSearchContext
-
parsedQuery
public SearchContext parsedQuery(ParsedQuery query)
- Specified by:
parsedQuery
in classSearchContext
-
parsedQuery
public ParsedQuery parsedQuery()
- Specified by:
parsedQuery
in classSearchContext
-
query
public org.apache.lucene.search.Query query()
Description copied from class:SearchContext
The query to execute, might be rewritten.- Specified by:
query
in classSearchContext
-
from
public int from()
- Specified by:
from
in classSearchContext
-
from
public SearchContext from(int from)
- Specified by:
from
in classSearchContext
-
size
public int size()
- Specified by:
size
in classSearchContext
-
size
public SearchContext size(int size)
- Specified by:
size
in classSearchContext
-
explain
public boolean explain()
- Specified by:
explain
in classSearchContext
-
explain
public void explain(boolean explain)
- Specified by:
explain
in classSearchContext
-
groupStats
public java.util.List<java.lang.String> groupStats()
- Specified by:
groupStats
in classSearchContext
-
groupStats
public void groupStats(java.util.List<java.lang.String> groupStats)
- Specified by:
groupStats
in classSearchContext
-
version
public boolean version()
- Specified by:
version
in classSearchContext
-
version
public void version(boolean version)
- Specified by:
version
in classSearchContext
-
docIdsToLoad
public int[] docIdsToLoad()
- Specified by:
docIdsToLoad
in classSearchContext
-
docIdsToLoadFrom
public int docIdsToLoadFrom()
- Specified by:
docIdsToLoadFrom
in classSearchContext
-
docIdsToLoadSize
public int docIdsToLoadSize()
- Specified by:
docIdsToLoadSize
in classSearchContext
-
docIdsToLoad
public SearchContext docIdsToLoad(int[] docIdsToLoad, int docsIdsToLoadFrom, int docsIdsToLoadSize)
- Specified by:
docIdsToLoad
in classSearchContext
-
accessed
public void accessed(long accessTime)
- Specified by:
accessed
in classSearchContext
-
lastAccessTime
public long lastAccessTime()
- Specified by:
lastAccessTime
in classSearchContext
-
keepAlive
public long keepAlive()
- Specified by:
keepAlive
in classSearchContext
-
keepAlive
public void keepAlive(long keepAlive)
- Specified by:
keepAlive
in classSearchContext
-
lookup
public SearchLookup lookup()
- Overrides:
lookup
in classSearchContext
-
dfsResult
public DfsSearchResult dfsResult()
- Specified by:
dfsResult
in classSearchContext
-
queryResult
public QuerySearchResult queryResult()
- Specified by:
queryResult
in classSearchContext
-
fetchResult
public FetchSearchResult fetchResult()
- Specified by:
fetchResult
in classSearchContext
-
fetchPhase
public FetchPhase fetchPhase()
- Specified by:
fetchPhase
in classSearchContext
-
smartNameFieldType
public MappedFieldType smartNameFieldType(java.lang.String name)
Description copied from class:SearchContext
Looks up the given field, but does not restrict to fields in the types set on this context.- Specified by:
smartNameFieldType
in classSearchContext
-
getObjectMapper
public ObjectMapper getObjectMapper(java.lang.String name)
- Specified by:
getObjectMapper
in classSearchContext
-
timeEstimateCounter
public org.apache.lucene.util.Counter timeEstimateCounter()
- Specified by:
timeEstimateCounter
in classSearchContext
-
addSearchExt
public void addSearchExt(SearchExtBuilder searchExtBuilder)
- Specified by:
addSearchExt
in classSearchContext
-
getSearchExt
public SearchExtBuilder getSearchExt(java.lang.String name)
- Specified by:
getSearchExt
in classSearchContext
-
getProfilers
public Profilers getProfilers()
Description copied from class:SearchContext
Return a handle over the profilers for the current search request, ornull
if profiling is not enabled.- Specified by:
getProfilers
in classSearchContext
-
queryCollectors
public java.util.Map<java.lang.Class<?>,org.apache.lucene.search.Collector> queryCollectors()
Description copied from class:SearchContext
Return a view of the additional query collectors that should be run for this context.- Specified by:
queryCollectors
in classSearchContext
-
getQueryShardContext
public QueryShardContext getQueryShardContext()
- Specified by:
getQueryShardContext
in classSearchContext
-
setTask
public void setTask(SearchTask task)
- Specified by:
setTask
in classSearchContext
-
getTask
public SearchTask getTask()
- Specified by:
getTask
in classSearchContext
-
isCancelled
public boolean isCancelled()
- Specified by:
isCancelled
in classSearchContext
-
collapse
public SearchContext collapse(CollapseContext collapse)
- Specified by:
collapse
in classSearchContext
-
collapse
public CollapseContext collapse()
- Specified by:
collapse
in classSearchContext
-
-