Skip to content

[docs] Add KQL docs for combining wildcards with special characters & keywords #161377

Description

@lukasolson

A request recently came up regarding querying documents with special characters and wildcards.

For example, given the following documents:

{
   "span.name": "Elasticsearch: POST /tmp-*/_search"
}

{
   "span.name": "Elasticsearch: POST /.kibana/_search"
}

"How do I filter for documents where the stuff inside the forward slashes does not start with a dot?"

They had tried several combinations of things with the wildcard inside of quotes, which doesn't work (we should make this explicit inside the docs). The answer ultimately came down to a combination of escaping special characters and wildcards:

span.name: Elasticsearch\: POST /*/_search AND NOT Elasticsearch\: POST /.*/_search

The follow-up question then was "What if the value contained and or or?" And the answer is to also escape keywords (which I don't think we have anywhere inside our docs): /and

We should add some more detail to our docs for these two things:

  1. Wildcards cannot be used inside quotes. If using wildcards, don't use quotes and escape all special characters.
  2. How to escape keywords (and/or/not)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature:KQLKQLIceboxTeam:DataDiscoveryDiscover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t//docsimpact:lowAddressing this issue will have a low level of impact on the quality/strength of our product.loe:smallSmall Level of Effort

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions