# Trying to vizualize "top N/ordered" ratios

**URL:** <https://discuss.elastic.co/t/trying-to-vizualize-top-n-ordered-ratios/95747>\
**Category:** Kibana\
**Created:** [August 3, 2017, 4:01pm UTC](https://discuss.elastic.co/t/trying-to-vizualize-top-n-ordered-ratios/95747 "2017-08-03T16:01:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![smcooper](https://avatars.discourse-cdn.com/v4/letter/s/ba9def/32.png) [@smcooper](https://discuss.elastic.co/u/smcooper)\
**Post date:** [August 3, 2017, 4:01pm UTC](https://discuss.elastic.co/t/trying-to-vizualize-top-n-ordered-ratios/95747/1 "2017-08-03T16:01:32Z")

</div>

Hi,

I am unsuccessfully trying to get a visualization of ordered ratio.  
After reading various posts/questions/requests I start to doubt that what I am  
looking for is (yet) available through Kibana, but as a I am a newbie and some  
of the post might be outdated, I thought I should better ask.

Here is the context: we are handling several hundreds of "institutions" and would  
like to spot the ones that have a large request failure rate (aka,  
the ones we should worry about).  
As we are dealing with large institutions (with thousands of  
requests) and small ones (generating a modest amount of requests), I can't rely  
on a count of failed requests, and need to examine a success/failure ratio.  
In addition, as we have hundreds of institutions, we can't display the ratio for  
each one of them on a single visualization, and would need to get a "top  
10/20/human-friendly-number".

I tried a **vertical stacked bar** visualization of the success and failure in  
**percentage mode** , but I can't find a way to get my institution ordered according  
to a percentage.  
To get a better idea, my problem is similar to the one depicted on this post:  
[Kibana - Customize order by using percentage from count aggregation](https://stackoverflow.com/questions/45059639/kibana-customize-order-by-using-percentage-from-count-aggregation?newreg=d23aa757e082445cb5b1b653e35d2a84)

I also looked into Timelion visualizations, as it allows to compute ratios and to  
apply conditions. I can easily compute failure ratios and display the pathological one (let's say over 50%) through something like

> .es('log:failure').divide(.es()).if(gte, 0.5, .es('log:failure').divide(.es()).multiply(100), null).

My problem is then to find a way to apply it for each institutions.  
My list is too long (and evolving) for me to apply filters  
individually in the command. Ideally, I would like to use split, but I  
don't know that is possible to carry the "Institution" into the divide  
section (as far as I know regex are only supported into label() ).

> .es('log:failure', split=Institution:X).divide(.es( institution-target-of-the-previous  
> -split? )).if(gte,0.5, ..., null)

If you have any idea or suggestion about how to address this problem, or if I  
overlooked or missed something, please let me know. Any help would be greatly appreciated. 🙂

---

<div class="post-metadata">

**Author:** ![Brandon\_Kobel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_kobel/32/14829_2.png) [@Brandon\_Kobel](https://discuss.elastic.co/u/Brandon_Kobel)\
**Post date:** [August 3, 2017, 6:28pm UTC](https://discuss.elastic.co/t/trying-to-vizualize-top-n-ordered-ratios/95747/2 "2017-08-03T18:28:57Z")

</div>

There isn't a way currently to do this in Kibana, and this enhancement request is outstanding to provide this functionality via the Bucket Script Aggregations in Elasticsearch: [https://github.com/elastic/kibana/issues/4707](https://github.com/elastic/kibana/issues/4707)

---

<div class="post-metadata">

**Author:** ![smcooper](https://avatars.discourse-cdn.com/v4/letter/s/ba9def/32.png) [@smcooper](https://discuss.elastic.co/u/smcooper)\
**Post date:** [August 4, 2017, 9:11pm UTC](https://discuss.elastic.co/t/trying-to-vizualize-top-n-ordered-ratios/95747/3 "2017-08-04T21:11:40Z")

</div>

Thank you very much for taking the time to answer.

Following this post:  
As I still need to spot our institutions in need, I decided to write an elasticsearch query, and I am not looking to visualize the answer.  
[How to parse ES json output. Scripting, re-indexing, other suggestion?](https://discuss.elastic.co/t/thanks-to-es-i-have-an-answer-what-options-do-i-have-to-make-it-more-human-readable/95953)

---

<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:** [September 1, 2017, 9:12pm UTC](https://discuss.elastic.co/t/trying-to-vizualize-top-n-ordered-ratios/95747/4 "2017-09-01T21:12:06Z")

</div>

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