I’ve tried all the options I am aware of (all template variables, scripted templates), but cannot figure out how to provide a Lucene Query (free text) that can be used across an entire Dashboard. I’m guessing this is unsupported, so I am open to hacking the code, but am not sure where to start.
What I am trying to accomplish is creating a full text Lucene query in a template field, that can be applied to all Panels.
For example, using play.grafana.org, I’ve edited the settings for the ‘ES Log Query’:
This produces a correct query (see debug code to right) to ES of: “query”:“deployed AND website AND Torkel”.
The goal is to duplicating this query input to the Dashboard as a variable that can be used in multiple panels. I’ve looked at what is available - the Adhoc type is fine for a limited vein of searches, but does not produce the same result, or provide the FTS capability, as it is tied to a specific field. The Query type doesn’t fit either, as I’ve tried several variations, the best of which I could come up with (which doesn’t work) is:
{“find”: “terms”,“query”: “”}. When providing the same same information, however, it produces a query to ES of: “query”:“\"deployed\ AND\ website\"”}. This does not produce the same results. Scripted dashboards, and a plethora of other variations don’t work - I can never get the same query to ES as I can from the form field typed in the Metrics tab.
This looks to me like a feature request for a new template variable, call it ‘Free Text’ or something, that you can insert into any/ all panels, to get the desired result (text typed into template variable form field then updates text in Query field of all panels that have that variable).
Would be grateful on some guidance on where to go to in source code to address this - creating a new template variable type that doesn’t have all the escaped/ munging with the current variables (unless I am missing an obvious solution to the problem. I’ve been messing with this for some time now).
Thanks.