Skip to content

[BUG] top_queries-* indices are not filter out when not use from & to parameters #477

@xiaoyuan0821

Description

@xiaoyuan0821

What is the bug?

Trying to get the top queries use following API

GET _insights/top_queries

it will response with something like this:

{
  "top_queries" : [
    {
      "timestamp" : 1761881222098,
      "source" : {
		// omit
      },
      "indices" : [
        "top_queries-2025.10.31-55872"
      ]
	  // omit
    }
  ]
}

I omit all other things except the indices.

But when I tries to use following API which use from and to sepcify time range which should include the query listed in the above, but it response nothing:

GET _insights/top_queries?from=2025-10-31T02:00:00.000Z&to=2025-10-31T03:35:00.000Z
{
  "top_queries" : [
  ]
}

How can one reproduce the bug?

Just run some queries.

What is the expected behavior?

the API which specify time range should include top_queries* indices.

What is your host/environment?

Linux
OpenSearch 3.3.2

Do you have any additional context?

Reason for this behavior is than when you specify time range, it will use checkIfInternal predicate to filter out the internal indices top_queries*.
see code snippet: https://github.com/opensearch-project/query-insights/blob/3.3.2.0/src/main/java/org/opensearch/plugin/insights/core/service/TopQueriesService.java#L343C53-L343C68

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions