From 371467979857d4ee0fcc3362062dae465ec6b8a5 Mon Sep 17 00:00:00 2001 From: Chenyang Ji Date: Thu, 6 Jun 2024 14:07:07 -0700 Subject: [PATCH 1/2] 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 44469fa64b..d1c1fa87d1 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 From 63f86e25ca7af1a110c3f54ab08d39319e1c77b7 Mon Sep 17 00:00:00 2001 From: Chenyang Ji Date: Mon, 10 Jun 2024 15:17:20 -0700 Subject: [PATCH 2/2] update the document to fix style checks Signed-off-by: Chenyang Ji --- .../query-insights/top-n-queries.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/_observing-your-data/query-insights/top-n-queries.md b/_observing-your-data/query-insights/top-n-queries.md index d1c1fa87d1..575c298472 100644 --- a/_observing-your-data/query-insights/top-n-queries.md +++ b/_observing-your-data/query-insights/top-n-queries.md @@ -82,9 +82,10 @@ 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. +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. -Configure the debug exporter for top queries by latency with +### Configuring the debug exporter +To export the top queries by latency using the debug exporter, use the following configuration: ```json PUT _cluster/settings { @@ -95,7 +96,7 @@ PUT _cluster/settings ``` {% include copy-curl.html %} -You can also configure the debug exporter for other metrics like cpu with +To configure the debug exporter for other metrics such as `CPU`, use: ```json PUT _cluster/settings { @@ -106,7 +107,8 @@ PUT _cluster/settings ``` {% 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 +### 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 { @@ -118,9 +120,9 @@ PUT _cluster/settings ``` {% 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). +For reference on the date pattern format, see the [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 +To configure the local index exporter for other metrics such as `CPU`, use: ```json PUT _cluster/settings { @@ -130,4 +132,6 @@ PUT _cluster/settings } } ``` -{% include copy-curl.html %} \ No newline at end of file +{% 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. \ No newline at end of file