Class QueryInsightsService

java.lang.Object
org.opensearch.common.lifecycle.AbstractLifecycleComponent
org.opensearch.plugin.insights.core.service.QueryInsightsService
All Implemented Interfaces:
Closeable, AutoCloseable, org.opensearch.common.lease.Releasable, org.opensearch.common.lifecycle.LifecycleComponent

public class QueryInsightsService extends org.opensearch.common.lifecycle.AbstractLifecycleComponent
Service responsible for gathering, analyzing, storing and exporting information related to search queries
Opensearch.internal:
  • Field Details

  • Constructor Details

    • QueryInsightsService

      @Inject public QueryInsightsService(ThreadPool threadPool)
      Constructor of the QueryInsightsService
      Parameters:
      threadPool - The OpenSearch thread pool to run async tasks
  • Method Details

    • addRecord

      public boolean addRecord(SearchQueryRecord record)
      Ingest the query data into in-memory stores
      Parameters:
      record - the record to ingest
    • drainRecords

      public void drainRecords()
      Drain the queryRecordsQueue into internal stores and services
    • getTopQueriesService

      public TopQueriesService getTopQueriesService(MetricType metricType)
      Get the top queries service based on metricType
      Parameters:
      metricType - MetricType
      Returns:
      TopQueriesService
    • enableCollection

      public void enableCollection(MetricType metricType, boolean enable)
      Set flag to enable or disable Query Insights data collection
      Parameters:
      metricType - MetricType
      enable - Flag to enable or disable Query Insights data collection
    • isCollectionEnabled

      public boolean isCollectionEnabled(MetricType metricType)
      Get if the Query Insights data collection is enabled for a MetricType
      Parameters:
      metricType - MetricType
      Returns:
      if the Query Insights data collection is enabled
    • isEnabled

      public boolean isEnabled()
      Check if query insights service is enabled
      Returns:
      if query insights service is enabled
    • doStart

      protected void doStart()
      Specified by:
      doStart in class org.opensearch.common.lifecycle.AbstractLifecycleComponent
    • doStop

      protected void doStop()
      Specified by:
      doStop in class org.opensearch.common.lifecycle.AbstractLifecycleComponent
    • doClose

      protected void doClose()
      Specified by:
      doClose in class org.opensearch.common.lifecycle.AbstractLifecycleComponent