Class TopQueriesService

java.lang.Object
org.opensearch.plugin.insights.core.service.TopQueriesService

public class TopQueriesService extends Object
Service responsible for gathering and storing top N queries with high latency or resource usage
Opensearch.internal:
  • Method Details

    • setTopNSize

      public void setTopNSize(int topNSize)
      Set the top N size for TopQueriesService service.
      Parameters:
      topNSize - the top N size to set
    • getTopNSize

      public int getTopNSize()
      Get the current configured top n size
      Returns:
      top n size
    • validateTopNSize

      public void validateTopNSize(int size)
      Validate the top N size based on the internal constrains
      Parameters:
      size - the wanted top N size
    • setEnabled

      public void setEnabled(boolean enabled)
      Set enable flag for the service
      Parameters:
      enabled - boolean
    • setWindowSize

      public void setWindowSize(TimeValue windowSize)
      Set the window size for top N queries service
      Parameters:
      windowSize - window size to set
    • validateWindowSize

      public void validateWindowSize(TimeValue windowSize)
      Validate if the window size is valid, based on internal constrains.
      Parameters:
      windowSize - the window size to validate
    • getTopQueriesRecords

      public List<SearchQueryRecord> getTopQueriesRecords(boolean includeLastWindow) throws IllegalArgumentException
      Get all top queries records that are in the current top n queries store Optionally include top N records from the last window. By default, return the records in sorted order.
      Parameters:
      includeLastWindow - if the top N queries from the last window should be included
      Returns:
      List of the records that are in the query insight store
      Throws:
      IllegalArgumentException - if query insight is disabled in the cluster
    • getTopQueriesCurrentSnapshot

      public List<SearchQueryRecord> getTopQueriesCurrentSnapshot()
      Get the current top queries snapshot from the AtomicReference.
      Returns:
      a list of SearchQueryRecord