How to modify the selected values from the filter in Grafana?

I am using a template variable for the filter to list down some of the string value from elasticsearch like


template variable name = version_name
column name in elastic search = version

Lucene Query : version:$version_name

when the user selects “string1_dev_01” it fetches data belongs to “string1_dev_01” from elasticsearch and display in a table panel.

But I want, when selecting either string1_dev_01 or string1_prod_01 it should fetch all data belongs to both the dev and prod.

After selected the version the string value should be modified and assigned to template variable


Final value assign to version like



  1. How can I modified the selected value like string1_*_01
  2. Lucene query should fetch value
    • starts with - string1_
    • ends with - _01

How can I achieve this in grafana? Thanks in advance.