And then I have an aggs to show only if min_doc_count : 2.
My question is if there is anyway to add a condition to the last term "results.value.testRun.name": "Live" to allow me to show results even if min_doc_count: 1 (But should be :2 for the other ones)
I don't quite understand what the aggregation is for. And how the field content for results.value.testRun.name looks like for some example documents. Is this a multi valued keyword field? Or some sort of text field where you want to match any of the three given terms?
Maybe an example with the mapping for the field, some example documents and a full example query including the agg would help to understand your goal better.
So, basically the field content is a string ("Live", "Test"). The aggregation is to show the testcases that belong to that testrun but if they failed more than 2 times.
I'm making some bold guesses abour your use case here but maybe you could use a filter aqggregation to create a bucket with all the docs with a "Live" failure and another top level one with all the results where you would use "min_doc_count" : 2? I think you need to de-duplicate somewhere in your application then unfortunately. This is a short example of what I mean but it might need some adaption to fit your needs:
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.