From fa8a109456656ad58dcd8d91d4b23c10003c8b7e Mon Sep 17 00:00:00 2001 From: Emily Guo <35637792+LilyCaroline17@users.noreply.github.com> Date: Tue, 29 Oct 2024 13:02:59 -0700 Subject: [PATCH] Added from and to parameters to top N queries to specify time range (#8132) * Added from and to parameters to top N queries to specify time range Signed-off-by: Emily Guo <35637792+LilyCaroline17@users.noreply.github.com> * Update _observing-your-data/query-insights/top-n-queries.md Co-authored-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> Signed-off-by: Emily Guo <35637792+LilyCaroline17@users.noreply.github.com> * Update _observing-your-data/query-insights/top-n-queries.md Co-authored-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> Signed-off-by: Emily Guo <35637792+LilyCaroline17@users.noreply.github.com> * Update _observing-your-data/query-insights/top-n-queries.md Co-authored-by: Nathan Bower Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> --------- Signed-off-by: Emily Guo <35637792+LilyCaroline17@users.noreply.github.com> Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> Co-authored-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> Co-authored-by: Nathan Bower Signed-off-by: Eric Pugh --- _observing-your-data/query-insights/top-n-queries.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/_observing-your-data/query-insights/top-n-queries.md b/_observing-your-data/query-insights/top-n-queries.md index b63d670926..a5bf42e694 100644 --- a/_observing-your-data/query-insights/top-n-queries.md +++ b/_observing-your-data/query-insights/top-n-queries.md @@ -96,6 +96,17 @@ GET /_insights/top_queries?type=memory ``` {% include copy-curl.html %} + +To specify a time range for querying top N results, use the `from` and `to` parameters in ISO8601 format: `YYYY-MM-DD'T'HH:mm:ss.SSSZ`. +For example, to retrieve the top N queries from August 25, 2024, at 15:00 UTC to August 30, 2024, at 17:00 UTC, send the following request: + +```json +GET /_insights/top_queries?from=2024-08-25T15:00:00.000Z&to=2024-08-30T17:00:00.000Z +``` +{% include copy-curl.html %} + +If you have a [local index exporter enabled](#configuring-a-local-index-exporter), historical queries stored in local OpenSearch indexes will also be included in the specified time range. + If your query returns no results, ensure that top N query monitoring is enabled for the target metric type and that search requests were made within the current [time window](#configuring-the-window-size). {: .important}