Basic alerting question (using ElasticSearch)

I’m evaluating Grafana and I’ve setup a few dashboards with elasticSearch as dataSource and looks great.
My question: I have an ES indices that contains HTTP call logs (response code, duration etc). How can I alert on non-200 response being 10% of total responses?

As far as I know, you cannot add alert condition based on multiple queries so I created an ES query that returns a series of percentage like this: non-200 divided with 200 status codes count.

Does Grafana support custom DSL query? Something like:

> {
>   "size": 0,
>   "aggs": {
>     "all": {
>       "date_histogram": {
>         "field": "@timestamp",
>         "interval": "hour"
>       },
>       "aggs": {
>         "non200": {
>           "filter": {
>                 "term": {
>                   someFilter
>                 }
>           }
>         },
>         "totals": {
>           "filter": {
>             "term": {
>               someOtherFilter
>             }
>           }
>         },
>         "succesrate": {
>           "bucket_script": {
>             "buckets_path": {
>               "fails": "non200._count",
>               "totals": "totals._count"
>             },
>             "script": "params.fails / params.totals"
>           }
>         }
>       }
>     }
>   }
> }