Skip to content

Commit

Permalink
Document for query insights exporter
Browse files Browse the repository at this point in the history
Signed-off-by: Chenyang Ji <[email protected]>
  • Loading branch information
ansjcy committed Jun 6, 2024
1 parent 6e2f1d4 commit 32002e9
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions _observing-your-data/query-insights/top-n-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,55 @@ Specify a metric type to filter the response by metric type (latency is the only
```json
GET /_insights/top_queries?type=latency
```
{% include copy-curl.html %}

## Export the top N queries data
You can configure your desired exporter to export the top n queries data to different sinks. Currently, supported exportors are debug exporter and local index exporter.

Check failure on line 85 in _observing-your-data/query-insights/top-n-queries.md

View workflow job for this annotation

GitHub Actions / style-job

[vale] reported by reviewdog 🐶 [OpenSearch.Spelling] Error: exportors. If you are referencing a setting, variable, format, function, or repository, surround it with tic marks. Raw Output: {"message": "[OpenSearch.Spelling] Error: exportors. If you are referencing a setting, variable, format, function, or repository, surround it with tic marks.", "location": {"path": "_observing-your-data/query-insights/top-n-queries.md", "range": {"start": {"line": 85, "column": 115}}}, "severity": "ERROR"}

Configure the debug exporter for top queries by latency with
```json
PUT _cluster/settings
{
"persistent" : {
"search.insights.top_queries.latency.exporter.type" : "debug"
}
}
```
{% include copy-curl.html %}

You can also configure the debug exporter for other metrics like cpu with

Check failure on line 98 in _observing-your-data/query-insights/top-n-queries.md

View workflow job for this annotation

GitHub Actions / style-job

[vale] reported by reviewdog 🐶 [OpenSearch.Spelling] Error: cpu. If you are referencing a setting, variable, format, function, or repository, surround it with tic marks. Raw Output: {"message": "[OpenSearch.Spelling] Error: cpu. If you are referencing a setting, variable, format, function, or repository, surround it with tic marks.", "location": {"path": "_observing-your-data/query-insights/top-n-queries.md", "range": {"start": {"line": 98, "column": 66}}}, "severity": "ERROR"}
```json
PUT _cluster/settings
{
"persistent" : {
"search.insights.top_queries.cpu.exporter.type" : "debug"
}
}
```
{% include copy-curl.html %}

Local index exporter is also supported to export the top n queries to local OpenSearch indices. You can configure the local index exporter with

Check failure on line 109 in _observing-your-data/query-insights/top-n-queries.md

View workflow job for this annotation

GitHub Actions / style-job

[vale] reported by reviewdog 🐶 [OpenSearch.SubstitutionsError] Use 'indexes' instead of 'indices'. Raw Output: {"message": "[OpenSearch.SubstitutionsError] Use 'indexes' instead of 'indices'.", "location": {"path": "_observing-your-data/query-insights/top-n-queries.md", "range": {"start": {"line": 109, "column": 88}}}, "severity": "ERROR"}
```json
PUT _cluster/settings
{
"persistent" : {
"search.insights.top_queries.latency.exporter.type" : "local_index",
"search.insights.top_queries.latency.exporter.config.index" : "YYYY.MM.dd"
}
}
```
{% include copy-curl.html %}

For a reference on the date pattern format, see the [Joda DateTimeFormat documentation](https://www.joda.org/joda-time/apidocs/org/joda/time/format/DateTimeFormat.html).

Check failure on line 121 in _observing-your-data/query-insights/top-n-queries.md

View workflow job for this annotation

GitHub Actions / style-job

[vale] reported by reviewdog 🐶 [OpenSearch.Spelling] Error: Joda. If you are referencing a setting, variable, format, function, or repository, surround it with tic marks. Raw Output: {"message": "[OpenSearch.Spelling] Error: Joda. If you are referencing a setting, variable, format, function, or repository, surround it with tic marks.", "location": {"path": "_observing-your-data/query-insights/top-n-queries.md", "range": {"start": {"line": 121, "column": 54}}}, "severity": "ERROR"}

You can also configure the local index exporter for other metrics like cpu with

Check failure on line 123 in _observing-your-data/query-insights/top-n-queries.md

View workflow job for this annotation

GitHub Actions / style-job

[vale] reported by reviewdog 🐶 [OpenSearch.Spelling] Error: cpu. If you are referencing a setting, variable, format, function, or repository, surround it with tic marks. Raw Output: {"message": "[OpenSearch.Spelling] Error: cpu. If you are referencing a setting, variable, format, function, or repository, surround it with tic marks.", "location": {"path": "_observing-your-data/query-insights/top-n-queries.md", "range": {"start": {"line": 123, "column": 72}}}, "severity": "ERROR"}
```json
PUT _cluster/settings
{
"persistent" : {
"search.insights.top_queries.cpu.exporter.type" : "local_index",
"search.insights.top_queries.cpu.exporter.config.index" : "YYYY.MM.dd"
}
}
```
{% include copy-curl.html %}

0 comments on commit 32002e9

Please sign in to comment.