Created
July 10, 2018 12:00
-
-
Save jakab922/e9f257292cf097dbfefdb764bb26aaa5 to your computer and use it in GitHub Desktop.
Aggregated elastic query
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"size": 0, | |
"query": { | |
"bool": { | |
"must": [ | |
{ "exists": {"field": "status" } }, | |
{ "exists": {"field": "class_name" } }, | |
{ "exists": {"field": "test_name" } } | |
] | |
} | |
}, | |
"aggs": { | |
"by_testcase": { | |
"terms": { | |
"size": 1000, | |
"script": { | |
"source": "doc['class_name.keyword'].value + '.' + doc['test_name.keyword'].value;", | |
"lang": "painless" | |
} | |
}, | |
"aggs": { | |
"by_best_case": { | |
"max": { | |
"script": { | |
"lang": "painless", | |
"source": "if(doc['status'].value == 'pass') {return 2;} else if(doc['status'].value == 'skip') {return 1;} else {return 0;}" | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment