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'
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 anes: stringschema field, and letting them write whatever they want in there, then parsing that to meanquery_string: $whateveron 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'