Skip to content

ESQL: Quotations in index patterns allow for inconsistent pattern composition #122651

Closed
@jbaiera

Description

@jbaiera

ES|QL allows for using quotations in index pattern names to escape characters that might otherwise break the syntax. An example of this might be something like

FROM "this=that", """this[that"""

Additionally, we allow users to specify their entire index pattern in a string literal:

FROM "index1,index2,index3"

I've found recently that you can currently mix and match this syntax with cluster id syntax (and eventually index selector logic #120660) to create index patterns that probably should not be allowed.

All of the following patterns are valid in ES|QL, and parse to their unquoted equivalents when executing:

FROM cluster:"index1,index2"
# resolves to [cluster:index1, index2]

FROM cluster1:"index1,cluster2:index2"
# resolves to [cluster1:index1, cluster2:index2]

FROM "clusterA":"index1,index2,index3"
# resolves to [clusterA:index1, index2, index3]

When combining this existing logic with #120660 we end up with valid patterns like the following:

FROM "clusterA":"index1,index2,index3"::"data"
# resolves to [clusterA:index1, index2, index3::data]

FROM "cluster*":"index*,index*,index*::failures,*"::failures
# resolves to [cluster*:index*, index*, index*::failures, *::failures]

FROM "index1,index2,*"::failures
# resolves to [index1, index2, *::failures]

This seems like invalid pattern parsing to me. In my mind cluster:"index1,index2" implies that the comma is escaped, or that both indices should be resolved from the remote cluster provided. Since this incompatibility is really only possible under CCS, I would make a case to disallow commas in the quoted portions of ESQL that include an unquoted cluster id prefix (and in the future, an index selector suffix).

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