Lucene query to retrieve each template variable in multiple queries

Hi @torkel @mefraimsson I am using
Elastic search - 6.2.5.
I have a template variable named Version with data version1,version2,version3…so on

Version1   Count
A              10
B              20
C              30 
Version2   Count
A              15
B              25
C              30

I have a third column that gets the percentage change between the two versions. The issue here is the Lucene query version.keyword:$version gets the combined percentage change of both versions. How do I get the data with each query gets each version data.
Such as Query A should get Version1 data and Query B should get Version2 data dynamically.
If I print the version name individually will get the data but how do we do dynamically
Query A : version.keyword: "Version1"
Query B: version.keyword: "Version2"

In Lucene query how do we get first and second variables from a template variable in multiple queries?

Hi, I think is not possible to do that. If I get right, you are using 2 queries because you have 2 versions, in case you have n version you need to add n queries?

Did you try using just 1 query and adding a group by version.keyword?

In case the above does not resolve your problem, try using a unique count with the version.keyword. You will get a count for each version.

Hope it helps!

Thank you for your response @nicolasvelazquez, Group by version gets me the total count of version. and the unique count gets me the count of version. My requirement is every version has some markers such as sys_error_connected, data_info_system etc…

Version1                          Count
`sys_error_connected`              30 
`data_info_system`                 15
Version2                          Count
`sys_error_connected`              20
`data_info_system`                 10
Version1                      Version2         Percentage Change
`sys_error_connected`  `sys_error_connected`       10%
`data_info_system`       `data_info_system`        5%

I am trying to get the percentage change between two versions grouped by markers. Even though there are n number of versions percentage change can be checked only between any two versions.

If percentage change can be checked only between any two versions. You can declare two template variables versions and use one for each query.

Hope it helps!

This is a good idea. But the main template variable version is being used for a complete dashboard with over 50 panels where multiple versions are selected to compare the data where any change in version will affect all other panels but just for this panel its comparison between any two versions. It looks like just for this panel I have to create two template variables and ask the user to choose another version from different template variable. Thanks @nicolasvelazquez