Skip to content

EuiSearchBar: allow arbitrary string when using quotes #2325

@bevacqua

Description

@bevacqua

In Cloud UI, we have a use case where we sometimes even the powerful expressions possible with <EuiSearchBar> are not enough, and some of our users need a escape hatch to make ES queries directly. We can mostly get by by adding an es: string schema field, and letting them write whatever they want in there, then parsing that to mean query_string: $whatever on our end.

This, however, hinges on EUI allowing arbitrary strings to be passed as clause values. Currently, this happens when using double quotes:

es:"data.resources.cpu.hard_limit:false AND data.hidden:false"
☠️ es:"data.resources.cpu.hard_limit:false AND data.hidden:false AND size<=2048"
☠️ es:"data.resources.cpu.hard_limit:false AND data.hidden:'false'"

The fails indicate Expected end of input or whitespace but "\"" found.

Using single quotes seems to work just fine:

es:'data.resources.cpu.hard_limit:false AND data.hidden:false'
es:'data.resources.cpu.hard_limit:false AND data.hidden:"false"
es:'data.resources.cpu.hard_limit:false AND data.hidden:false AND size >= 2048'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions