Interface SearchOperationListener

All Known Implementing Classes:
SearchOperationListener.CompositeListener, SearchSlowLog, ShardSearchStats

public interface SearchOperationListener
An listener for search, fetch and context events.
  • Method Details

    • onPreQueryPhase

      default void onPreQueryPhase(SearchContext searchContext)
      Executed before the query phase is executed
      Parameters:
      searchContext - the current search context
    • onFailedQueryPhase

      default void onFailedQueryPhase(SearchContext searchContext)
      Executed if a query phased failed.
      Parameters:
      searchContext - the current search context
    • onQueryPhase

      default void onQueryPhase(SearchContext searchContext, long tookInNanos)
      Executed after the query phase successfully finished. Note: this is not invoked if the query phase execution failed.
      Parameters:
      searchContext - the current search context
      tookInNanos - the number of nanoseconds the query execution took
      See Also:
      onFailedQueryPhase(SearchContext)
    • onPreFetchPhase

      default void onPreFetchPhase(SearchContext searchContext)
      Executed before the fetch phase is executed
      Parameters:
      searchContext - the current search context
    • onFailedFetchPhase

      default void onFailedFetchPhase(SearchContext searchContext)
      Executed if a fetch phased failed.
      Parameters:
      searchContext - the current search context
    • onFetchPhase

      default void onFetchPhase(SearchContext searchContext, long tookInNanos)
      Executed after the fetch phase successfully finished. Note: this is not invoked if the fetch phase execution failed.
      Parameters:
      searchContext - the current search context
      tookInNanos - the number of nanoseconds the fetch execution took
      See Also:
      onFailedFetchPhase(SearchContext)
    • onNewReaderContext

      default void onNewReaderContext(ReaderContext readerContext)
      Executed when a new reader context was created
      Parameters:
      readerContext - the created context
    • onFreeReaderContext

      default void onFreeReaderContext(ReaderContext readerContext)
      Executed when a previously created reader context is freed. This happens either when the search execution finishes, if the execution failed or if the search context as idle for and needs to be cleaned up.
      Parameters:
      readerContext - the freed reader context
    • onNewScrollContext

      default void onNewScrollContext(ReaderContext readerContext)
      Executed when a new scroll search ReaderContext was created
      Parameters:
      readerContext - the created reader context
    • onFreeScrollContext

      default void onFreeScrollContext(ReaderContext readerContext)
      Executed when a scroll search SearchContext is freed. This happens either when the scroll search execution finishes, if the execution failed or if the search context as idle for and needs to be cleaned up.
      Parameters:
      readerContext - the freed search context
    • validateReaderContext

      default void validateReaderContext(ReaderContext readerContext, TransportRequest transportRequest)
      Executed prior to using a ReaderContext that has been retrieved from the active contexts. If the context is deemed invalid a runtime exception can be thrown, which will prevent the context from being used.
      Parameters:
      readerContext - The reader context used by this request.
      transportRequest - the request that is going to use the search context