quickwit-oss / quickwit-datasource

Quickwit data source for Grafana
GNU Affero General Public License v3.0
41 stars 10 forks source link

Wildcard in a text box escapes the wildcard #130

Open mzupan opened 3 months ago

mzupan commented 3 months ago

Using the plugin, if I set a textbox variable and use a wildcard like

Screenshot 2024-06-09 at 9 38 10 AM

In the query it is escaping the *. Here is the query it sent to quickwit

query:"status_code:[200 TO 499] AND endpoint:\"\\*\""

This is my query for the graph

status_code:[200 TO 499] AND endpoint:"$endpoint"

Also tried

status_code:[200 TO 499] AND endpoint:$endpoint
status_code:[200 TO 499] AND endpoint:""$endpoint
uptickmetachu commented 2 months ago

everything is escaped when sent via query it seems.

This severely limits the use of variables as a way to drill down for search.

fmassot commented 2 months ago

@mzupan @uptickmetachu I think it's possible to avoid this pb. On Fly.io we have a query text box, and this works: ${query:text}

To give you the full query run on Fly: fly.app.name:${app:singlequote} fly.app.instance:${instance:singlequote} ${query:text}

Note that in the grafana plugin, the default boolean operator is AND, so in this example, quickwit will really execute fly.app.name:${app:singlequote} AND fly.app.instance:${instance:singlequote} AND ${query:text}

uptickmetachu commented 2 months ago

Yup works for me!

I do have to use some querybuilding trickery to make it work as a field exists * when nothing is selected and as a quoted text for when a value is selected.