Elasticsearch - Multiple count queries with different filters in bucket script

I have an integer field (let’s call it num_errors) in Elasticsearch that contains the number of errors in that data point. In Grafana, I need to visualize what percentage of the time this is or is not zero.

It’s easy enough to filter the count to remove data points with non-zero values via a Lucene query (num_errors: 0). I do not see a way to divide this by a count of values that aren’t filtered with a Lucene query.

Is this possible to do in Grafana?