Class QueryRewriteAsyncAction<T,U extends QueryRewriteAsyncAction<T,U>>

java.lang.Object
org.elasticsearch.index.query.QueryRewriteAsyncAction<T,U>
Direct Known Subclasses:
QueryRewriteRemoteAsyncAction

public abstract class QueryRewriteAsyncAction<T,U extends QueryRewriteAsyncAction<T,U>> extends Object
Represents a unique action that needs to be executed asynchronously during query rewriting. A QueryRewriteAsyncAction is registered using QueryRewriteContext.registerUniqueAsyncAction(QueryRewriteAsyncAction, Consumer). This is useful when we want to remove duplicate and costly async actions that take part in query rewriting, such as generating embeddings for semantic search. Since we need to determine whether an action has already been registered, we require implementors to provide implementations for hashCode() and equals(Object),
  • Constructor Details

    • QueryRewriteAsyncAction

      public QueryRewriteAsyncAction()
  • Method Details

    • execute

      public final void execute(Client client, ActionListener<?> listener, List<Consumer<?>> consumers)
      The execute method will: - Execute the action using execute(Client, ActionListener) - Pass the action result to the consumers and execute the consumers - Call the final listener
      Parameters:
      client - An internal client that can be used during execution.
      listener - The listener that will be called after the action and consumers have been executed.
      consumers - A list of consumer that expect the result of the action.
    • execute

      protected abstract void execute(Client client, ActionListener<T> listener)
      This method will execute the async action and pass its result to the listener.
      Parameters:
      client - An internal client that can be used during execution.
      listener - The listener that will be called with the action result
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • doHashCode

      public abstract int doHashCode()
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • doEquals

      public abstract boolean doEquals(U other)