# Painless - calculation of the ration of number of two contexts with status code

**URL:** <https://discuss.elastic.co/t/painless-calculation-of-the-ration-of-number-of-two-contexts-with-status-code/151676>\
**Category:** Kibana\
**Created:** [October 9, 2018, 3:39pm UTC](https://discuss.elastic.co/t/painless-calculation-of-the-ration-of-number-of-two-contexts-with-status-code/151676 "2018-10-09T15:39:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bm\_rec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bm_rec/32/24470_2.png) [@bm\_rec](https://discuss.elastic.co/u/bm_rec)\
**Post date:** [October 9, 2018, 3:39pm UTC](https://discuss.elastic.co/t/painless-calculation-of-the-ration-of-number-of-two-contexts-with-status-code/151676/1 "2018-10-09T15:39:50Z")

</div>

Hello! I need to calculate ratio of two URI with status codes 200 and status code above 200, then pass it in Grafana and finally get alert. I'm going to create extra scripted field. Can somebody help me, please?

 ![photo_2018-10-09_18-34-05](https://us1.discourse-cdn.com/elastic/original/3X/4/3/43b03aa3895b9ce20b4a685c3b436edf3c39a214.jpeg)

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [October 11, 2018, 12:49pm UTC](https://discuss.elastic.co/t/painless-calculation-of-the-ration-of-number-of-two-contexts-with-status-code/151676/2 "2018-10-11T12:49:41Z")

</div>

The easiest way to achieve this in Kibana is with pipeline aggregations. I don't think this is available in Grafana as it's not a fork of Kibana that we maintain,  
[https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline.html)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 8, 2018, 12:49pm UTC](https://discuss.elastic.co/t/painless-calculation-of-the-ration-of-number-of-two-contexts-with-status-code/151676/3 "2018-11-08T12:49:43Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
