-
Notifications
You must be signed in to change notification settings - Fork 500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Query Insights documentation #6261
Changes from all commits
94f689e
c466d4a
18c9959
28607d3
b82330b
0fd4191
f186bc7
53c032c
4f24d1e
4a53088
52b383b
42b9e34
fd90983
b3d2581
0a79b38
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,38 @@ | ||||||
--- | ||||||
layout: default | ||||||
title: Query insights | ||||||
nav_order: 40 | ||||||
has_children: true | ||||||
has_toc: false | ||||||
--- | ||||||
|
||||||
# Query insights | ||||||
|
||||||
To monitor and analyze the search queries within your OpenSearch clusterQuery information, you can obtain query insights. With minimal performance impact, query insights features aim to provide comprehensive insights into search query execution, enabling you to better understand search query characteristics, patterns, and system behavior during query execution stages. Query insights facilitate enhanced detection, diagnosis, and prevention of query performance issues, ultimately improving query processing performance, user experience, and overall system resilience. | ||||||
Check failure on line 11 in _observing-your-data/query-insights/index.md GitHub Actions / style-job
|
||||||
|
||||||
Typical use cases for query insights features include the following: | ||||||
|
||||||
- Identifying top queries by latency within specific time frames | ||||||
- Debugging slow search queries and latency spikes | ||||||
|
||||||
Query insights features are supported by the Query Insights plugin. At a high level, query insights features comprise the following components: | ||||||
|
||||||
* _Collectors_: Gather performance-related data points at various stages of search query execution. | ||||||
* _Processors_: Perform lightweight aggregation and processing on data collected by the collectors. | ||||||
* _Exporters_: Export the data into different sinks. | ||||||
|
||||||
|
||||||
## Installing the Query Insights plugin | ||||||
|
||||||
You need to install the `query-insights` plugin to enable query insights features. To install the plugin, run the following command: | ||||||
|
||||||
```bash | ||||||
bin/opensearch-plugin install query-insights | ||||||
``` | ||||||
For information about installing plugins, see [Installing plugins]({{site.url}}{{site.baseurl}}/install-and-configure/plugins/). | ||||||
|
||||||
## Query insights settings | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This heading is referenced in the settings documentation so it's better to have an explicit reference to query insights because then the link name is more precise. |
||||||
|
||||||
Query insights features support the following settings: | ||||||
|
||||||
- [Top n queries]({{site.url}}{{site.baseurl}}/observing-your-data/query-insights/top-n-queries/) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
--- | ||
layout: default | ||
title: Top n queries | ||
parent: Query insights | ||
nav_order: 65 | ||
--- | ||
|
||
# Top n queries | ||
|
||
Monitoring the top N queries in query insights features can help you gain real-time insights into the top queries with high latency within a certain time frame (for example, the last hour). | ||
|
||
## Getting started | ||
|
||
To enable monitoring of the top N queries, configure the following [dynamic settings]({{site.url}}{{site.baseurl}}/install-and-configure/configuring-opensearch/index/#dynamic-settings): | ||
|
||
- `search.insights.top_queries.latency.enabled`: Set to `true` to [enable monitoring of the top N queries](#enabling-the-top-n-queries-feature). | ||
- `search.insights.top_queries.latency.window_size`: [Configure the window size](#configuring-window-size). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Global: Instead of "window size", which is ambiguous, please use something like "time frame" or "time period". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's leave as "window size". We have other settings that reference window size in OpenSearch and I think this is generally understood in the community. |
||
- `search.insights.top_queries.latency.top_n_size`: [Specify the value of n](#configuring-the-value-of-n). | ||
|
||
It's important to exercise caution when enabling this feature because it can consume system resources. | ||
{: .important} | ||
|
||
|
||
For detailed information about enabling and configuring this feature, see the following sections. | ||
|
||
## Enabling the top N queries feature | ||
|
||
After installing the `query-insights` plugin, you can enable the top N queries feature (which is disabled by default) by using the following dynamic setting. This setting enables the corresponding collectors and aggregators in the running cluster: | ||
|
||
```json | ||
PUT _cluster/settings | ||
{ | ||
"persistent" : { | ||
"search.insights.top_queries.latency.enabled" : true | ||
} | ||
} | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
## Configuring window size | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace "window size". |
||
|
||
You can configure the window size for the top N queries by latency with `search.insights.top_queries.latency.window_size`. For example, a cluster with the following configuration will collect top N queries in a 60-minute window: | ||
|
||
```json | ||
PUT _cluster/settings | ||
{ | ||
"persistent" : { | ||
"search.insights.top_queries.latency.window_size" : "60m" | ||
} | ||
} | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
## Configuring the value of N | ||
|
||
You can configure the value of N in the `search.insights.top_queries.latency.top_n_size` parameter. For example, a cluster with the following configuration will collect the top 10 queries in the specified window size: | ||
|
||
``` | ||
PUT _cluster/settings | ||
{ | ||
"persistent" : { | ||
"search.insights.top_queries.latency.top_n_size" : 10 | ||
} | ||
} | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
## Monitoring the top N queries | ||
|
||
You can use the Insights API endpoint to obtain top N queries by latency: | ||
|
||
```json | ||
GET /_insights/top_queries | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
Specify a metric type to filter the response by metric type (latency is the only supported type as of 2.12): | ||
|
||
```json | ||
GET /_insights/top_queries?type=latency | ||
``` | ||
{% include copy-curl.html %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Global: It's not ideal to have one thing named the "Query Insights plugin" and to then name something within that "query insights" or "query insights features." This can result in reader confusion regarding which one we're referencing as well as awkward phrasing throughout.