# How to get terms from two indices with worst ration?

**URL:** <https://discuss.elastic.co/t/how-to-get-terms-from-two-indices-with-worst-ration/95661>\
**Category:** Kibana\
**Created:** [August 3, 2017, 8:03am UTC](https://discuss.elastic.co/t/how-to-get-terms-from-two-indices-with-worst-ration/95661 "2017-08-03T08:03:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yannick-cw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yannick-cw/32/34220_2.png) [@yannick-cw](https://discuss.elastic.co/u/yannick-cw)\
**Post date:** [August 3, 2017, 8:03am UTC](https://discuss.elastic.co/t/how-to-get-terms-from-two-indices-with-worst-ration/95661/1 "2017-08-03T08:03:26Z")

</div>

Hey I am trying to create a visualisation of the terms with the worst ratio of appearing in two indices.

Basically I have documents in two indices with a name field, now I want to be able to see the names where the `count in index 1 / count in index 2` percentage is the lowest.

I see how I could do this in timelion for individual names:  
`.es(q'name:Test',index='index1',metric='count).divide(.es(q'name:Test',index='index2',metric='count'))`

This gives me the exact ratio for the queried name, but I need to get all the names, for which this ratio is the lowest.  
Trying to split at `name` fails, as I can not divide by another `split` series.  
Could I get this visualisation with a different approach / visualisation tool?

thanks,  
yannick

---

<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, 12:54pm UTC](https://discuss.elastic.co/t/how-to-get-terms-from-two-indices-with-worst-ration/95661/2 "2017-08-03T12:54:28Z")

</div>

@yannick-cw there isn't currently a way to do calculations on the documents in two different indices in Kibana.

---

<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:** [August 31, 2017, 12:54pm UTC](https://discuss.elastic.co/t/how-to-get-terms-from-two-indices-with-worst-ration/95661/3 "2017-08-31T12:54:30Z")

</div>

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