Skip to content
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

Merged
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/vale/styles/Vocab/OpenSearch/Plugins/accept.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ ML Commons plugin
Neural Search plugin
Observability plugin
Performance Analyzer plugin
Query Insights plugin
Query Workbench plugin
Search Relevance plugin
Security plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ The Notifications plugin supports the following settings. All settings in this l

- `opensearch.notifications.general.filter_by_backend_roles` (Boolean): Enables filtering by backend roles (role-based access control for the notification channels). Default is `false`.

## Query Insights plugin settings

For information about the Query Insights plugin settings, see [Query insights settings]({{site.url}}{{site.baseurl}}/observing-your-data/query-insights/index#query-insights-settings).
kolchfa-aws marked this conversation as resolved.
Show resolved Hide resolved

## Security plugin settings

For information about the Security plugin settings, see [Security settings]({{site.url}}{{site.baseurl}}/install-and-configure/configuring-opensearch/security-settings/).
Expand Down
9 changes: 5 additions & 4 deletions _install-and-configure/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ You can also list installed plugins by using the [CAT API]({{site.url}}{{site.ba
GET _cat/plugins
```

#### Sample response
#### Example response

```bash
opensearch-node1 opensearch-alerting 2.0.1.0
Expand Down Expand Up @@ -237,11 +237,11 @@ bin/opensearch-plugin install --batch <plugin-name>
Major, minor, and patch plugin versions must match OpenSearch major, minor, and patch versions in order to be compatible. For example, plugins versions 2.3.0.x work only with OpenSearch 2.3.0.
{: .warning}

### Bundled Plugins
### Bundled plugins

The following plugins are bundled with all OpenSearch distributions except for minimum distribution packages.

| Plugin Name | Repository | Earliest Available Version |
| Plugin name | Repository | Earliest available version |
| :--- | :--- | :--- |
| Alerting | [opensearch-alerting](https://github.com/opensearch-project/alerting) | 1.0.0 |
| Anomaly Detection | [opensearch-anomaly-detection](https://github.com/opensearch-project/anomaly-detection) | 1.0.0 |
Expand Down Expand Up @@ -271,7 +271,7 @@ _<sup>2</sup>Performance Analyzer is not available on Windows._

Members of the OpenSearch community have built countless plugins for the service. Although it isn't possible to build an exhaustive list of every plugin, since many plugins are not maintained within the OpenSearch GitHub repository, the following list of plugins are available to be installed by name using `bin/opensearch-plugin install <plugin-name>`.

| Plugin Name | Earliest Available Version |
| Plugin name | Earliest available version |
| :--- | :--- |
| analysis-icu | 1.0.0 |
| analysis-kuromoji | 1.0.0 |
Expand All @@ -287,6 +287,7 @@ Members of the OpenSearch community have built countless plugins for the service
| mapper-annotated-text | 1.0.0 |
| mapper-murmur3 | 1.0.0 |
| mapper-size | 1.0.0 |
| query-insights | 2.12.0 |
| repository-azure | 1.0.0 |
| repository-gcs | 1.0.0 |
| repository-hdfs | 1.0.0 |
Expand Down
38 changes: 38 additions & 0 deletions _observing-your-data/query-insights/index.md
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
Copy link
Collaborator

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.


Query insights helps you monitor and analyze the search queries within your OpenSearch cluster. 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.
kolchfa-aws marked this conversation as resolved.
Show resolved Hide resolved

Typical use cases of query insights include the following:
kolchfa-aws marked this conversation as resolved.
Show resolved Hide resolved

- Identifying top queries by latency within specific time frames.
kolchfa-aws marked this conversation as resolved.
Show resolved Hide resolved
- Debugging slow search queries and latency spikes.
kolchfa-aws marked this conversation as resolved.
Show resolved Hide resolved

Query insights features are backed up by the Query Insights plugin. At a high level, query insights comprises the following components:
kolchfa-aws marked this conversation as resolved.
Show resolved Hide resolved

* _Collectors_: Gather performance-related data points at various stages of search query execution within OpenSearch.
kolchfa-aws marked this conversation as resolved.
Show resolved Hide resolved
* _Processors_: Perform lightweight aggregation and processing on data collected by the collectors.
* _Exporters_: Export the insights data into different sinks.
kolchfa-aws marked this conversation as resolved.
Show resolved Hide resolved


## Installing the OpenSearch Query Insights plugin
kolchfa-aws marked this conversation as resolved.
Show resolved Hide resolved

You need to install the `query-insights` plugin to enable query insights. To install the plugin, run the following command:
kolchfa-aws marked this conversation as resolved.
Show resolved Hide resolved

```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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Query insights settings
## Settings

Copy link
Collaborator

Choose a reason for hiding this comment

The 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 supports the following settings:
kolchfa-aws marked this conversation as resolved.
Show resolved Hide resolved

- [Top n queries]({{site.url}}{{site.baseurl}}/observing-your-data/query-insights/top-n-queries/)
82 changes: 82 additions & 0 deletions _observing-your-data/query-insights/top-n-queries.md
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 top n queries in query insights can help you gain real-time insights into the top queries with high latency in a certain window (for example, the last hour).
kolchfa-aws marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Global: Should "n" be formatted with something like italics?


## Getting started

To enable top n queries monitoring, configure the following [dynamic settings]({{site.url}}{{site.baseurl}}/install-and-configure/configuring-opensearch/index/#dynamic-settings):
kolchfa-aws marked this conversation as resolved.
Show resolved Hide resolved

- `search.insights.top_queries.latency.enabled`: Set to `true` to [enable top n query monitoring](#enabling-top-n-queries).
kolchfa-aws marked this conversation as resolved.
Show resolved Hide resolved
- `search.insights.top_queries.latency.window_size`: [Configure the window size](#configuring-window-size).
Copy link
Collaborator

Choose a reason for hiding this comment

The 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".

Copy link
Collaborator

Choose a reason for hiding this comment

The 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 n value](#configuring-top-n-size).
kolchfa-aws marked this conversation as resolved.
Show resolved Hide resolved

It's important to exercise caution when enabling this feature because it can consume system resources.
{: .important}


For detailed information about enabling and configuring top n queries, see the following sections.
kolchfa-aws marked this conversation as resolved.
Show resolved Hide resolved

## Enabling top n queries
kolchfa-aws marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Global: This is also an awkward name for a 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 query insights collectors and aggregators in the running cluster:
kolchfa-aws marked this conversation as resolved.
Show resolved Hide resolved

```json
PUT _cluster/settings
{
"persistent" : {
"search.insights.top_queries.latency.enabled" : true
}
}
```
{% include copy-curl.html %}

## Configuring window size
Copy link
Collaborator

Choose a reason for hiding this comment

The 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:
kolchfa-aws marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related to my earlier comment about the formatting of "n", should we be using "N" globally, as we do here? Replace "window size". Should the end of the first sentence read "the search.insights.top_queries.latency.window_size [noun]"?


```json
PUT _cluster/settings
{
"persistent" : {
"search.insights.top_queries.latency.window_size" : "60m"
}
}
```
{% include copy-curl.html %}

## Configuring top n size
kolchfa-aws marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wording is also awkward and starts to become confusing when attempting to differentiate the content in this section from the preceding content. In other words, what is a "top n size"?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reworded.


You can configure the top n size using `search.insights.top_queries.latency.top_n_size`. For example, a cluster with the following configuration will collect the top 10 queries in the specified window size:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the end of the first sentence read "the search.insights.top_queries.latency.top_n_size [noun]"? Replace "window size".

kolchfa-aws marked this conversation as resolved.
Show resolved Hide resolved

```
PUT _cluster/settings
{
"persistent" : {
"search.insights.top_queries.latency.top_n_size" : 10
}
}
```
{% include copy-curl.html %}

## Monitoring top n queries
kolchfa-aws marked this conversation as resolved.
Show resolved Hide resolved

You can use the Insights API endpoint to obtain top n queries by latency:
kolchfa-aws marked this conversation as resolved.
Show resolved Hide resolved

```json
GET /_insights/top_queries
```
{% include copy-curl.html %}

Specify the type of metric you're interested in to filter the response by metric type (latency is the only supported type as of 2.12):
kolchfa-aws marked this conversation as resolved.
Show resolved Hide resolved

```json
GET /_insights/top_queries?type=latency
```
{% include copy-curl.html %}
Loading