Change a variable acording to another

Hello,

I display grafana dashboard using elasticsearch.
I have a field ‘name’ and various indicator field.
According to the field ‘name’ the indicator have value or not.
I have created 2 variables a variable ‘name’ for the name field which contain the name’s terms
and a variable ‘indicator’ for the indicator fields.
When I select a name I would like to filter the variable 'indicator 'in order to display only the indicators for which there is a value. Is that possible?

Thanks

I think so but can you show your variable queries?

There is an example with chained variables for Elasticsearch on the play site if you haven’t seen it already.

The query for the host variable is chained to the source variable looks like this:

{"find": "terms", "field": "@hostname", "query": "@source:$source"}

So when the $source variable changes, then a new host query is triggered and returns a filtered list. For example, if I choose backend as source then the host variable will only show backend servers.

My problem seems to be that I want to filter the fields and not the terms
for the name variable
{“find”:“terms”,“field”:“name.keyword”}
for the indicator
{“find”:“fields”} with a regex -.* indicator start with a -

I try {“find”:“fields”, “query:name.keyword:$name”} it’s not working

Definitely not working…

Try this

  1. Create first variable name: name
    query: {"find":"terms", "field":"name.keyword"}

  2. Create second variable name: “as you wish”
    query: {"find":"terms", "field": "$name", "query":""}

Fadjar Tandabawana

1 Like