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

Document for query insights exporter #7327

Closed
Closed
Changes from all 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
57 changes: 56 additions & 1 deletion _observing-your-data/query-insights/top-n-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,59 @@ 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 %}
{% 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 exporters are the debug exporter and the local index exporter.

### Configuring the debug exporter
To export the top queries by latency using the debug exporter, use the following configuration:
```json
PUT _cluster/settings
{
"persistent" : {
"search.insights.top_queries.latency.exporter.type" : "debug"
}
}
```
{% include copy-curl.html %}

To configure the debug exporter for other metrics such as `CPU`, use:
```json
PUT _cluster/settings
{
"persistent" : {
"search.insights.top_queries.cpu.exporter.type" : "debug"
}
}
```
{% include copy-curl.html %}

### Configuring the local index exporter
The local index exporter allows you to export the top N queries to local OpenSearch indexes. To configure the local index exporter for latency, use:
```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 reference on the date pattern format, see the [DateTimeFormat documentation](https://www.joda.org/joda-time/apidocs/org/joda/time/format/DateTimeFormat.html).

To configure the local index exporter for other metrics such as `CPU`, use:
```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 %}

By configuring these settings, you can direct the query insights data to the appropriate sink, allowing for better monitoring and analysis of your OpenSearch queries.
Loading