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
,org.elasticsearch.common.util.concurrent.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 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)
MappedFieldType
fieldType(java.lang.String name)
Given the full name of a field, returns itsMappedFieldType
.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()
long
getRelativeTimeInMillis()
Returns time in milliseconds that can be used for relative time calculations.SearchExtBuilder
getSearchExt(java.lang.String name)
SearchShardTask
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)
SearchContextId
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()
boolean
seqNoAndPrimaryTerm()
indicates whether the sequence number and primary term of the last modification to each hit should be returnedvoid
seqNoAndPrimaryTerm(boolean seqNoAndPrimaryTerm)
controls whether the sequence number and primary term of the last modification to each hit should be returnedvoid
setTask(SearchShardTask task)
SearchShardTarget
shardTarget()
SimilarityService
similarityService()
int
size()
SearchContext
size(int size)
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.elasticsearch.common.unit.TimeValue
timeout()
void
timeout(org.elasticsearch.common.unit.TimeValue timeout)
boolean
trackScores()
SearchContext
trackScores(boolean trackScores)
int
trackTotalHitsUpTo()
Indicates the total number of hits to count accurately.SearchContext
trackTotalHitsUpTo(int trackTotalHitsUpTo)
boolean
version()
void
version(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:
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
- Specified by:
storedFieldsContext
in classSearchContext
-
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
- Specified by:
id
in classSearchContext
-
source
public java.lang.String source()- Specified by:
source
in classSearchContext
-
request
- Specified by:
request
in classSearchContext
-
searchType
- Specified by:
searchType
in classSearchContext
-
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
- Specified by:
scrollContext
in classSearchContext
-
scrollContext
- Specified by:
scrollContext
in classSearchContext
-
aggregations
- Specified by:
aggregations
in classSearchContext
-
aggregations
- Specified by:
aggregations
in classSearchContext
-
highlight
- Specified by:
highlight
in classSearchContext
-
highlight
- Specified by:
highlight
in classSearchContext
-
innerHits
- Overrides:
innerHits
in classSearchContext
-
suggest
- Specified by:
suggest
in classSearchContext
-
suggest
- Specified by:
suggest
in classSearchContext
-
rescore
- Specified by:
rescore
in classSearchContext
- Returns:
- list of all rescore contexts. empty if there aren't any.
-
addRescore
- Specified by:
addRescore
in classSearchContext
-
hasScriptFields
public boolean hasScriptFields()- Specified by:
hasScriptFields
in classSearchContext
-
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
- Specified by:
fetchSourceContext
in classSearchContext
-
fetchSourceContext
- Specified by:
fetchSourceContext
in classSearchContext
-
searcher
- Specified by:
searcher
in classSearchContext
-
indexShard
- Specified by:
indexShard
in classSearchContext
-
mapperService
- Specified by:
mapperService
in classSearchContext
-
similarityService
- Specified by:
similarityService
in classSearchContext
-
bigArrays
- Specified by:
bigArrays
in classSearchContext
-
bitsetFilterCache
- Specified by:
bitsetFilterCache
in classSearchContext
-
getForField
- Specified by:
getForField
in classSearchContext
-
timeout
public org.elasticsearch.common.unit.TimeValue timeout()- Specified by:
timeout
in classSearchContext
-
timeout
public void timeout(org.elasticsearch.common.unit.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
- Specified by:
minimumScore
in classSearchContext
-
minimumScore
public java.lang.Float minimumScore()- Specified by:
minimumScore
in classSearchContext
-
sort
- Specified by:
sort
in classSearchContext
-
sort
- Specified by:
sort
in classSearchContext
-
trackScores
- Specified by:
trackScores
in classSearchContext
-
trackScores
public boolean trackScores()- Specified by:
trackScores
in classSearchContext
-
trackTotalHitsUpTo
- Specified by:
trackTotalHitsUpTo
in classSearchContext
-
trackTotalHitsUpTo
public int trackTotalHitsUpTo()Description copied from class:SearchContext
Indicates the total number of hits to count accurately. Defaults toSearchContext.DEFAULT_TRACK_TOTAL_HITS_UP_TO
.- Specified by:
trackTotalHitsUpTo
in classSearchContext
-
searchAfter
- Specified by:
searchAfter
in classSearchContext
-
searchAfter
public org.apache.lucene.search.FieldDoc searchAfter()- Specified by:
searchAfter
in classSearchContext
-
parsedPostFilter
- Specified by:
parsedPostFilter
in classSearchContext
-
parsedPostFilter
- Specified by:
parsedPostFilter
in classSearchContext
-
aliasFilter
public org.apache.lucene.search.Query aliasFilter()- Specified by:
aliasFilter
in classSearchContext
-
parsedQuery
- Specified by:
parsedQuery
in classSearchContext
-
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
- Specified by:
from
in classSearchContext
-
size
public int size()- Specified by:
size
in classSearchContext
-
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
-
seqNoAndPrimaryTerm
public boolean seqNoAndPrimaryTerm()Description copied from class:SearchContext
indicates whether the sequence number and primary term of the last modification to each hit should be returned- Specified by:
seqNoAndPrimaryTerm
in classSearchContext
-
seqNoAndPrimaryTerm
public void seqNoAndPrimaryTerm(boolean seqNoAndPrimaryTerm)Description copied from class:SearchContext
controls whether the sequence number and primary term of the last modification to each hit should be returned- Specified by:
seqNoAndPrimaryTerm
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
- Overrides:
lookup
in classSearchContext
-
dfsResult
- Specified by:
dfsResult
in classSearchContext
-
queryResult
- Specified by:
queryResult
in classSearchContext
-
fetchResult
- Specified by:
fetchResult
in classSearchContext
-
fetchPhase
- Specified by:
fetchPhase
in classSearchContext
-
fieldType
Description copied from class:SearchContext
Given the full name of a field, returns itsMappedFieldType
.- Specified by:
fieldType
in classSearchContext
-
getObjectMapper
- Specified by:
getObjectMapper
in classSearchContext
-
getRelativeTimeInMillis
public long getRelativeTimeInMillis()Description copied from class:SearchContext
Returns time in milliseconds that can be used for relative time calculations. WARN: This is not the epoch time.- Specified by:
getRelativeTimeInMillis
in classSearchContext
-
addSearchExt
- Specified by:
addSearchExt
in classSearchContext
-
getSearchExt
- Specified by:
getSearchExt
in classSearchContext
-
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
- Specified by:
getQueryShardContext
in classSearchContext
-
setTask
- Specified by:
setTask
in classSearchContext
-
getTask
- Specified by:
getTask
in classSearchContext
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelled
in classSearchContext
-
collapse
- Specified by:
collapse
in classSearchContext
-
collapse
- Specified by:
collapse
in classSearchContext
-