Divide the two query in Elasticsearch as data source in grafana

Hi Team,

I am using Elastic search as my data source and I am using two queries which gives the output of total hits code (200-500 status code) and second query which gives the error codes(>=499 status code).

I want to take the output from both the query by dividing the second query to first,Can you please help me on this to get the output.

Thank you