|
| 1 | +--- |
| 2 | +title: Query insights dashboards |
| 3 | +layout: default |
| 4 | +parent: Query insights |
| 5 | +nav_order: 60 |
| 6 | +--- |
| 7 | + |
| 8 | +# Query insights dashboards |
| 9 | + |
| 10 | +You can interact with the query insights feature using the Query Insights Dashboards plugin. This plugin gives you real-time and historical insights into query performance, providing analytics and monitoring to improve how queries are run in your cluster. |
| 11 | + |
| 12 | +## Prerequisites |
| 13 | + |
| 14 | +The Query Insights Dashboards plugin requires [OpenSearch 2.19 or later]({{site.url}}{{site.baseurl}}/install-and-configure/). |
| 15 | + |
| 16 | +## Installing the plugin |
| 17 | + |
| 18 | +To install the Query Insights Dashboards plugin, see [Managing OpenSearch Dashboards plugins]({{site.url}}{{site.baseurl}}/install-and-configure/install-dashboards/plugins/). |
| 19 | + |
| 20 | +## Navigation |
| 21 | + |
| 22 | +After logging in to OpenSearch Dashboards, you can find the **Query insights** page by navigating to **OpenSearch Plugins** > **Query insights**. |
| 23 | + |
| 24 | +If you have [multiple data sources]({{site.url}}{{site.baseurl}}/dashboards/management/multi-data-sources/) enabled, the **Query insights** page can be found by navigating to **Data administration** > **Performance** > **Query insights**. |
| 25 | +{: .note} |
| 26 | + |
| 27 | +The **Query insights** dashboard contains the following pages: |
| 28 | + |
| 29 | +- [Top N queries](#top-n-queries): Displays the query metrics and details for the top queries. |
| 30 | +- [Query details](#query-details): Displays details for individual queries and query groups. |
| 31 | +- [Configuration](#configuration): Customizes all monitoring and data retention settings for the query insights feature. |
| 32 | + |
| 33 | + |
| 34 | +## Top N queries |
| 35 | + |
| 36 | +The **Top N queries** page provides a detailed overview of the queries that have the highest impact on system resources or performance. There, you can analyze query metrics such as **latency**, **CPU time**, and **memory usage**. |
| 37 | + |
| 38 | +The following image of the **Top N queries** page contains letter labels for each component. |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | +Each label corresponds to the following components: |
| 43 | + |
| 44 | +- [A. Navigation tabs](#a-navigation-tabs) |
| 45 | +- [B. Search queries bar](#b-search-queries-bar) |
| 46 | +- [C. Filters](#c-filters) |
| 47 | +- [D. Date range selector](#d-date-range-selector) |
| 48 | +- [E. Refresh button](#e-refresh-button) |
| 49 | +- [F. Metrics table](#f-metrics-table) |
| 50 | + |
| 51 | +### A. Navigation tabs |
| 52 | + |
| 53 | +The navigation tabs allow you to switch between the **Configuration** and **Top N queries** pages. |
| 54 | + |
| 55 | +### B. Search queries bar |
| 56 | + |
| 57 | +The search queries bar filters queries based on specific attributes such as **query type** or **indexes**. You can use additional filters as shown in the [Filters](#c-filters) section. |
| 58 | + |
| 59 | +### C. Filters |
| 60 | + |
| 61 | +The filters dropdown menus allow you to select the following query filters. |
| 62 | + |
| 63 | +| Filter | Description | Example | |
| 64 | +|-------------------------|---------------------------------------------------------------------|--------------------| |
| 65 | +| **Type** | Filter by query type. | `query`, `group` | |
| 66 | +| **Indexes** | Filter queries based on specific OpenSearch indexes. | `index1`, `index2` | |
| 67 | +| **Search Type** | Filter by search execution method. | `query then fetch` | |
| 68 | +| **Coordinator Node ID** | Focus on queries executed by a specific coordinator node. | `node-1`, `node-2` | |
| 69 | +| **Time Range** | Adjust the time range for the queries displayed. | `last 1 day` | |
| 70 | + |
| 71 | +### D. Date range selector |
| 72 | + |
| 73 | +The **data range selector** analyzes queries sent during a set time frame. You can also select **Show dates** to provide detailed time stamps for each query. |
| 74 | + |
| 75 | +### E. Refresh button |
| 76 | + |
| 77 | +The **Refresh** button reloads the query data based on the selected filters and time range. |
| 78 | + |
| 79 | +### F. Metrics table |
| 80 | + |
| 81 | +The metrics table displays the following metrics for each query. |
| 82 | + |
| 83 | +| Metric | Description | |
| 84 | +|-------------------------|-----------------------------------------------------------------------------| |
| 85 | +| **ID** | The unique identifier for the query. | |
| 86 | +| **Type** | The type of query, such as `query`or `group`. | |
| 87 | +| **Query Count** | The number of times that the query has been executed. | |
| 88 | +| **Timestamp** | When the query was run. | |
| 89 | +| **Latency** | The time taken for the query to execute. | |
| 90 | +| **CPU Time** | The CPU resources consumed by the query. | |
| 91 | +| **Memory Usage** | The memory usage of the query. | |
| 92 | +| **Indexes** | The index or indexes on which the query was executed. | |
| 93 | +| **Search Type** | The type of search used, for example, `query then fetch`. | |
| 94 | +| **Coordinator Node ID** | The node that coordinated the query. | |
| 95 | +| **Total Shards** | The total number of shards involved in running the query. | |
| 96 | + |
| 97 | + |
| 98 | +## Query details |
| 99 | + |
| 100 | +The **Query details** page provides insights into query behavior, performance, and structure. You can access the query details page by selecting the query ID, as shown in the following image: |
| 101 | + |
| 102 | + |
| 103 | + |
| 104 | +### Viewing individual query details |
| 105 | + |
| 106 | +You can access detailed information about a single query by selecting the query ID, such as `51c68a1a-7507-4b3e-aea1-32ddd74dbac4`. The query details page will appear, as shown in the following image. |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | +In the query details view, you can view information such as **Timestamp**, **CPU Time**, **Memory Usage**, **Indexes**, **Search Type**, **Coordinator Node ID**, and **Total Shards**. |
| 111 | + |
| 112 | +### Viewing query group details |
| 113 | + |
| 114 | +The query group details view provides insights into aggregated metrics for a group of similar queries. |
| 115 | + |
| 116 | +To view query group details, select a query ID marked as a "group" in the **Top N queries** list. The query group details view provides the following information: |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | +- The **Aggregate summary for queries** section provides a view of key query metrics for the entire group, including **Average latency**, **Average CPU time**, **Average memory usage**, and **Group by** criteria. |
| 121 | +- The **Sample query details** section provides information about a single representative query, including its **Timestamp**, **Indexes**, **Search Type**, **Coordinator Node ID**, and **Total Shards**. |
| 122 | +- The **Query** section displays the JSON structure of the query. |
| 123 | +- The **Latency** section presents a graphical representation of the run phases for the query. |
| 124 | + |
| 125 | +## Configuration |
| 126 | + |
| 127 | +The **Query insights - Configuration** page is designed to gives you control over how the query insights feature collects, monitors, groups, and retains data. The following image shows the configuration page. |
| 128 | + |
| 129 | + |
| 130 | + |
| 131 | +On the configuration page, you can configure the settings described in the following sections. |
| 132 | + |
| 133 | +### Top N queries monitoring |
| 134 | + |
| 135 | +The **Top n queries monitoring configuration settings** allow you to track query performance metrics, such as **Latency**, **CPU Usage**, and **Memory**, to analyze and optimize query performance. The configuration interface provides a structured, menu-driven setup through which you can define specific metrics to be monitored, set thresholds for analysis, and customize monitoring durations. |
| 136 | + |
| 137 | +Perform the following to configure the top N queries settings: |
| 138 | + |
| 139 | +1. From the **Query insights** page, navigate to the **Configuration** tab. |
| 140 | +2. Select the metric type: **Latency**, **CPU Usage**, or **Memory**. |
| 141 | +3. Toggle the **Enabled** setting to turn the top N queries feature on or off for the selected metric. |
| 142 | +4. Specify the monitoring **Window size**, which determines the duration of the time queries collected for analysis. |
| 143 | +5. Enter the value of **N**, which defines the number of top queries to track in each window. |
| 144 | +6. Select **Save**. |
| 145 | +7. Check the **Statuses for configuration metrics** panel to see the enabled metrics. |
| 146 | + |
| 147 | +### Top N queries grouping |
| 148 | + |
| 149 | +The **Top n queries group configuration settings** set the grouping settings for queries. |
| 150 | + |
| 151 | +Use the following steps to set specific grouping attributes: |
| 152 | + |
| 153 | +1. Select a grouping option under **Group By**, such as **Similarity**. |
| 154 | +2. Select **Save**. |
| 155 | +3. Check the **Statuses for group by** panel to verify whether the **Group by** criteria is enabled. |
| 156 | + |
| 157 | +### Data export and retention |
| 158 | + |
| 159 | +To configuring data export and retention, use the **Query insights export and data retention settings** panel. There, you can set the following settings: |
| 160 | + |
| 161 | +1. Under **Exporter**, choose a destination for the data, such as **Local index**. |
| 162 | +2. Set the **Delete After (days)** field with a data retention period. |
| 163 | +3. Select **Save**. |
| 164 | +4. In the **Statuses for data retention** panel, make sure that the **Exporter** setting is enabled. |
| 165 | + |
| 166 | +### Configuration best practices |
| 167 | + |
| 168 | +When configuring the query insights feature, remember the following best practices: |
| 169 | + |
| 170 | +- Begin with a smaller value for N (count) and increase it based on your system's load. |
| 171 | +- Choose your **Window size** carefully. A longer window size can save compute resources because the insights found are less granular. Inversely, a shorter window size can output more comprehensive query insights but uses more resources. |
| 172 | +- When setting data retention periods, consider shorter retention periods that save storage but reduce the number of long-term insights. |
| 173 | +- Enable metrics based on your monitoring needs. Monitoring fewer metrics prevents system overload. |
| 174 | + |
| 175 | + |
| 176 | + |
| 177 | + |
| 178 | + |
0 commit comments