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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addRescore(RescoreContext rescore)
void
addSearchExt(SearchExtBuilder searchExtBuilder)
aggregations(SearchContextAggregations aggregations)
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.collapse()
collapse(CollapseContext collapse)
int[]
docIdsToLoad(int[] docIdsToLoad, int docsIdsToLoadSize)
boolean
explain()
void
explain(boolean explain)
fetchSourceContext(FetchSourceContext fetchSourceContext)
int
from()
from(int from)
Return a handle over the profilers for the current search request, ornull
if profiling is not enabled.long
Returns time in milliseconds that can be used for relative time calculations.getSearchExt(String name)
getTask()
void
groupStats(List<String> groupStats)
boolean
boolean
boolean
void
highlight(SearchHighlightContext highlight)
id()
boolean
boolean
Indicates if the current index should perform frequent low level search cancellation check.minimumScore(float minimumScore)
int
parsedPostFilter(ParsedQuery postFilter)
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.Return a view of the additional query collectors that should be run for this context.request()
rescore()
org.apache.lucene.search.FieldDoc
searchAfter(org.apache.lucene.search.FieldDoc searchAfter)
searcher()
boolean
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)
int
size()
size(int size)
sort()
sort(SortAndFormats sort)
source()
boolean
A shortcut function to see whether there is a fetchSourceContext and it says the source is requested.storedFieldsContext(StoredFieldsContext storedFieldsContext)
suggest()
void
suggest(SuggestionSearchContext suggest)
int
void
terminateAfter(int terminateAfter)
org.elasticsearch.core.TimeValue
timeout()
void
timeout(org.elasticsearch.core.TimeValue timeout)
boolean
trackScores(boolean trackScores)
int
Indicates the total number of hits to count accurately.trackTotalHitsUpTo(int trackTotalHitsUpTo)
boolean
version()
void
version(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:
hasStoredFields
in classSearchContext
-
storedFieldsContext
- Specified by:
storedFieldsContext
in classSearchContext
-
storedFieldsContext
- Specified by:
storedFieldsContext
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
- 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
-
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.
-
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
-
bitsetFilterCache
- Specified by:
bitsetFilterCache
in classSearchContext
-
timeout
public org.elasticsearch.core.TimeValue timeout()- Specified by:
timeout
in classSearchContext
-
timeout
public void timeout(org.elasticsearch.core.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
- 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
-
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
- Specified by:
groupStats
in classSearchContext
-
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
-
docIdsToLoad
- Specified by:
docIdsToLoad
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
-
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
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
-
getSearchExecutionContext
- Specified by:
getSearchExecutionContext
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
-
addRescore
- Specified by:
addRescore
in classSearchContext
-
readerContext
- Specified by:
readerContext
in classSearchContext
-