Elasticsearch multiple queries, combining columns with different terms

I have a panel querying an Elasticsearch data source. I have two queries which use the exists query to determine which field to GroupBy. For example, the queries are:

Query 1
VOName:$vo AND ResourceType:$type AND exists:OIM_Facility
GroupBy: OIM_Facility

Query 2
VOName:$vo AND ResourceType:$type AND NOT exists:OIM_Facility
GroupBy: OIM_Site

When I display this in a table, I want to merge the OIM_Facility and OIM_Site columns. In a previous version of Grafana (4.6.3), they would merge automatically.

Grafana: 6.5.2

1 Like

I also want to do something like this. Did you come across a solution?

No, I never found a solution.

I literally found a solution today, but only for Grafana 7.
In v7+ you can, when defining your queries, go to the Transformations tab and choose Merge. As long as you have two columns the same - one in each result set, it will merge the values.

Huh, that is not exactly what I was looking for. I was more looking for something that would do this

Query 1 result:

Facility Core Hours
Site 1 10
Site 2 30

Query 2 Result:

Facility Core Hours
Site 3 50
Site 4 70

And the final table would be:

Facility Core Hours
Site 1 10
Site 2 30
Site 3 50
Site 4 70

There would be no duplicate in the Facility column.