How to implment compound query in kibana

On your My_Test_VIZ issue, you say you have the first and third step but need the second. And the second step is to find ONLY the tests where the latest result is failed. I'm not sure that's possible. Or maybe only with the custom JSON scripting. At the bottom of the Split Rows aggregation, click the Advanced link and you should see the "JSON Input" field.

I don't know much about using this JSON scripting myself, but I found one example here; Display concurrency in data on Kibana

You can't do any of this aggregation in Discover.