Skip to content

Commit

Permalink
combine exporter and metrics enhancements documents into one PR
Browse files Browse the repository at this point in the history
Signed-off-by: Chenyang Ji <[email protected]>
  • Loading branch information
ansjcy committed Jun 13, 2024
1 parent 8173348 commit 314bc92
Showing 1 changed file with 56 additions and 1 deletion.
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 @@ -142,4 +142,59 @@ GET /_insights/top_queries?type=latency
GET /_insights/top_queries?type=cpu
GET /_insights/top_queries?type=memory
```
{% 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.

0 comments on commit 314bc92

Please sign in to comment.