Module org.elasticsearch.server
Class AutoPrefilteringScope
java.lang.Object
org.elasticsearch.index.query.support.AutoPrefilteringScope
- All Implemented Interfaces:
Closeable,AutoCloseable,Releasable
Keeps track of queries to be used as prefilters.
During
QueryBuilder.toQuery(SearchExecutionContext), each query pushes queries to be used
as prefilters to the AutoPrefilteringScope. Queries that need to apply prefilters can
fetch them by calling getPrefilters().
The scope is implemented as a stack Deque of lists of prefilters.
As we move down the query tree, each query may push a list of prefilters.
A query that consumes prefilters fetches a flattened list of all prefilters in scope via getPrefilters().
When the query leaves the scope, pop() should be called to remove the latest list of prefilters from the stack.
This way queries in other query tree branches will not fetch irrelevant prefilters.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Returns all prefilters in scope.voidpop()Removes the latest list of prefilters from the scope.voidpush(List<QueryBuilder> prefilters) Pushes a list of prefilters to the scope.
-
Constructor Details
-
AutoPrefilteringScope
public AutoPrefilteringScope()
-
-
Method Details
-
push
Pushes a list of prefilters to the scope. -
pop
public void pop()Removes the latest list of prefilters from the scope. -
getPrefilters
Returns all prefilters in scope. -
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceReleasable
-