Chained variables not work as expect in elasticsearch data source

  • What Grafana version and what operating system are you using?
    v7.5.12 (896df7435d)
  • What are you trying to achieve?
    Use variable inside another variable, aka chained variables
  • How are you trying to achieve it?
    I have a variable which type is query:
{"find": "terms", "field": "geoip.country_name.keyword"}

it’s a list of different countries, and I turned on Include all option for this variable.

Then inside anthoer variable called common which is constant type, I set the value to geoip.country_name.keyword:$country

I want to directly use the common variable in my query

  • What happened?
    The country variable behavior is different from directly using in query and use in another variable. There are two main problem:
  • : being translated to \\:
  • for all option the value of $country is different from directly used in query

the result looks like:

geoip.country_name.keyword\\:{Australia,Austria,Brazil,Bulgaria,Canada,China,Cyprus,Ecuador,France,Georgia,Germany,Greece,Hong Kong}

The expected result:

geoip.country_name.keyword:(\"Australia\" OR \"Austria\" OR \"Brazil\" OR \"Bulgaria\" OR \"Canada\" OR \"China\" OR \"Cyprus\" OR \"Ecuador\" OR \"France\" OR \"Georgia\" OR \"Germany\" OR \"Greece\" OR \"Hong\\ Kong\")
  • What did you expect to happen?

Chained variables work same with it in query

  • Can you copy/paste the configuration(s) that you are having problems with?
    the counrty variable

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

no error

  • Did you follow any online instructions? If so, what is the URL?