I have a bunch of data representing individual runs of jobs in a cluster. There are a couple thousand unique kinds of jobs, and so one of the fields in each entry is the job's name. Other fields include duration, success/failure/other, and some various other fields.
I'd like to find the Top N jobs by failure rate. I've created a Data Table, and added a bucket using "Terms" aggregation on the Name field. For the metric I've chosen count. This gives me the Top N jobs by number of times they were run.
First question: Is it possible to add new metrics where the column counts only those values that match a specific condition? For example, maybe a job is run 1000 times, it fails 10 times and succeeds 990 times. I'd like columns "Success", "Fail", and "Count" with values 990, 10, and 1000 respectively. Currently I can only figure out how to get the 1000.
Second question: Is it possible to add a metric that is calculated as Fail / Count, and have the Data Table contain only the Top N jobs according to Fail / Count?