Skip to content

Commit

Permalink
Add Query Insights local index delete after documentation (#9052)
Browse files Browse the repository at this point in the history
* Add Query Insights local index delete after documentation

Signed-off-by: David Zane <[email protected]>

* Update _observing-your-data/query-insights/top-n-queries.md

Co-authored-by: kolchfa-aws <[email protected]>
Signed-off-by: David Zane <[email protected]>

* Update _observing-your-data/query-insights/top-n-queries.md

Co-authored-by: kolchfa-aws <[email protected]>
Signed-off-by: David Zane <[email protected]>

* Update _observing-your-data/query-insights/top-n-queries.md

Co-authored-by: kolchfa-aws <[email protected]>
Signed-off-by: David Zane <[email protected]>

* Update _observing-your-data/query-insights/top-n-queries.md

Co-authored-by: kolchfa-aws <[email protected]>
Signed-off-by: David Zane <[email protected]>

* Update _observing-your-data/query-insights/top-n-queries.md

Co-authored-by: Nathan Bower <[email protected]>
Signed-off-by: David Zane <[email protected]>

* Update _observing-your-data/query-insights/top-n-queries.md

Co-authored-by: Nathan Bower <[email protected]>
Signed-off-by: David Zane <[email protected]>

* Update _observing-your-data/query-insights/top-n-queries.md

Co-authored-by: Nathan Bower <[email protected]>
Signed-off-by: David Zane <[email protected]>

* Update _observing-your-data/query-insights/top-n-queries.md

Co-authored-by: Nathan Bower <[email protected]>
Signed-off-by: David Zane <[email protected]>

---------

Signed-off-by: David Zane <[email protected]>
Signed-off-by: David Zane <[email protected]>
Co-authored-by: kolchfa-aws <[email protected]>
Co-authored-by: Nathan Bower <[email protected]>
  • Loading branch information
3 people authored Jan 14, 2025
1 parent 800a39e commit 414639f
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions _observing-your-data/query-insights/top-n-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,30 +118,47 @@ You can configure your desired exporter to export top N query data to different

### Configuring a debug exporter

To configure a debug exporter, update the exporter setting for the desired metric type. For example, to export the top N queries by latency using the debug exporter, send the following request:
To use the debug exporter, change the exporter type to `debug` for each metric type. For example, to use the debug exporter for all metric types, send the following request:

```json
PUT _cluster/settings
{
"persistent" : {
"search.insights.top_queries.latency.exporter.type" : "debug"
"search.insights.top_queries.latency.exporter.type" : "debug",
"search.insights.top_queries.cpu.exporter.type" : "debug",
"search.insights.top_queries.memory.exporter.type" : "debug"
}
}
```
{% include copy-curl.html %}

### Configuring a local index exporter

A local index exporter allows you to export the top N queries to local OpenSearch indexes. The default index pattern for top N query indexes is `top_queries-YYYY.MM.dd`. All top queries from the same day are saved to the same index, and a new index is created each day. You can change the default index pattern to use other date formats. For more information about supported formats, see [DateTimeFormat](https://www.joda.org/joda-time/apidocs/org/joda/time/format/DateTimeFormat.html).
A local index exporter allows you to save top N query data to indexes that are automatically created in your OpenSearch domain. Query Insights creates these indexes following the naming pattern `top_queries-YYYY.MM.dd-hashcode`, where `hashcode` is a 5-digit number generated based on the current UTC date. A new index is created daily. For historical top N lookups using the Top Queries API or the Query Insights Dashboard, you must enable the local index exporter.

To configure the local index exporter for the top N queries by latency, send the following request:
To use the local index exporter, set the exporter type for the desired metrics to `local_index`:

```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"
"search.insights.top_queries.cpu.exporter.type" : "local_index",
"search.insights.top_queries.memory.exporter.type" : "local_index"
}
}
```
{% include copy-curl.html %}

Use the `delete_after_days` setting (integer) to specify the number of days after which local indexes are automatically deleted. Query Insights runs a scheduled job once per day to delete top N local indexes older than the specified number of days. The default value for `delete_after_days` is 7, with valid values ranging from `1` to `180`. This setting applies to local index exporters of all metric types.

For example, to delete local indexes after 7 days, send the following request:

```json
PUT _cluster/settings
{
"persistent" : {
"search.insights.top_queries.delete_after_days" : "7"
}
}
```
Expand Down

0 comments on commit 414639f

Please sign in to comment.