java.lang.Object
org.elasticsearch.index.query.QueryRewriteContext
- Direct Known Subclasses:
CoordinatorRewriteContext,SearchExecutionContext
Context object used to rewrite
QueryBuilder instances into simplified version.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionQueryRewriteContext(XContentParserConfiguration parserConfiguration, NamedWriteableRegistry writeableRegistry, Client client, LongSupplier nowInMillis) -
Method Summary
Modifier and TypeMethodDescriptionReturns an instance ofSearchExecutionContextif available of null otherwisevoidexecuteAsyncActions(ActionListener listener) Executes all registered async actions and notifies the listener once it's done.The registry used to build newXContentParsers.booleanReturnstrueif there are any registered async actions.longReturns the time in milliseconds that is shared across all resources involved.voidregisterAsyncAction(BiConsumer<Client, ActionListener<?>> asyncAction) Registers an async action that must be executed before the next rewrite round in order to make progress.
-
Field Details
-
client
-
nowInMillis
-
-
Constructor Details
-
QueryRewriteContext
public QueryRewriteContext(XContentParserConfiguration parserConfiguration, NamedWriteableRegistry writeableRegistry, Client client, LongSupplier nowInMillis)
-
-
Method Details
-
getParserConfig
The registry used to build newXContentParsers. Contains registered named parsers needed to parse the query. -
nowInMillis
public long nowInMillis()Returns the time in milliseconds that is shared across all resources involved. Even across shards and nodes. -
getWriteableRegistry
-
convertToSearchExecutionContext
Returns an instance ofSearchExecutionContextif available of null otherwise -
convertToCoordinatorRewriteContext
-
registerAsyncAction
Registers an async action that must be executed before the next rewrite round in order to make progress. This should be used if a rewriteabel needs to fetch some external resources in order to be executed ie. a document from an index. -
hasAsyncActions
public boolean hasAsyncActions()Returnstrueif there are any registered async actions. -
executeAsyncActions
Executes all registered async actions and notifies the listener once it's done. The value that is passed to the listener is alwaysnull. The list of registered actions is cleared once this method returns.
-