From 32002e9bc55ed4257edff9e9dd893ec10037b657 Mon Sep 17 00:00:00 2001 From: Chenyang Ji Date: Thu, 6 Jun 2024 14:07:07 -0700 Subject: [PATCH] Document for query insights exporter Signed-off-by: Chenyang Ji --- .../query-insights/top-n-queries.md | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/_observing-your-data/query-insights/top-n-queries.md b/_observing-your-data/query-insights/top-n-queries.md index 44469fa64b3..d1c1fa87d18 100644 --- a/_observing-your-data/query-insights/top-n-queries.md +++ b/_observing-your-data/query-insights/top-n-queries.md @@ -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. + +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 +```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 +```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). + +You can also configure the local index exporter for other metrics like cpu with +```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 %} \ No newline at end of file