Skip to content

ESQL: Filtering on _index is ignored #129511

Open
@nik9000

Description

@nik9000

Description

I was trying to debug something with our logging cluster and ran:

POST _query 
{
  "query": "FROM logging-*:logs-* METADATA _index\n| WHERE _index NOT LIKE \"*east*\"\n| STATS c=COUNT(*) BY _index\n| SORT c DESC\n| LIMIT 10",
  "locale": "en",
  "include_ccs_metadata": true,
  "filter": {
    "bool": {
      "must": [],
      "filter": [
        {
          "range": {
            "@timestamp": {
              "format": "strict_date_optional_time",
              "gte": "2025-06-16T21:37:04.079Z",
              "lte": "2025-06-16T21:52:04.079Z"
            }
          }
        }
      ],
      "should": [],
      "must_not": []
    }
  },
  "profile": true
}

The top hit was for logging-us-east-1:.ds-logs-proxy.log-default-2025.06.14-001371. Which contains east. If I shift the WHERE to after the STATS the filtering works.

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