# How to calculate combinating different index with different mapping in order to show a histogram in Kibana

**URL:** <https://discuss.elastic.co/t/how-to-calculate-combinating-different-index-with-different-mapping-in-order-to-show-a-histogram-in-kibana/230140>\
**Category:** Kibana\
**Created:** [April 28, 2020, 10:42am UTC](https://discuss.elastic.co/t/how-to-calculate-combinating-different-index-with-different-mapping-in-order-to-show-a-histogram-in-kibana/230140 "2020-04-28T10:42:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Juanjo\_Herrero\_Berme](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/juanjo_herrero_berme/32/50275_2.png) [@Juanjo\_Herrero\_Berme](https://discuss.elastic.co/u/Juanjo_Herrero_Berme)\
**Post date:** [April 28, 2020, 10:42am UTC](https://discuss.elastic.co/t/how-to-calculate-combinating-different-index-with-different-mapping-in-order-to-show-a-histogram-in-kibana/230140/1 "2020-04-28T10:42:51Z")

</div>

Hi,

I have a question about Kibana and how to do calculates combinating different index with different mapping.

I want to create a graphic using TSVB or just a line chart that calculates a "Rate", but the problem is i need to use the count about two different index with different mapping.

The index 1 is a list of incidents with some fields (company, date, info about incidents, etc) and the index 2 is a list of installed base with differents fields (company, date, another info).

The Rate is just : count(incidents) / count (installed base) grouped by month in order to get a line char that shows the rate for each month in all year (January: 10%, Feb: 13%...)

So, i tried to use TSVB, and i can got both counts separated in the same graphic and grouped by months, but i can't combine them in an aggregation with Math function to calculate this Rate.

Besides, i though about create an script field, but, if im right, TSVB can`t use it.  
On the other hand, char line visualization allows to use script field but not combine index pattern (if im right again)

So, how could i make this and similar calculates using combine index patterns?

I hope i have explained this as best i can.  
Thanks for the help!

---

<div class="post-metadata">

**Author:** ![Luca\_Belluccini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luca_belluccini/32/33239_2.png) [@Luca\_Belluccini](https://discuss.elastic.co/u/Luca_Belluccini)\
**Post date:** [April 28, 2020, 11:28pm UTC](https://discuss.elastic.co/t/how-to-calculate-combinating-different-index-with-different-mapping-in-order-to-show-a-histogram-in-kibana/230140/2 "2020-04-28T23:28:30Z")

</div>

Hello @Juanjo_Herrero_Berme

I think the only way to compute a ratio easily from different indices would be using [Timelion](https://www.elastic.co/guide/en/kibana/current/timelion.html) or Vega.  
It is also possible with TSVB but it depends on how data is structured.

> [@Juanjo\_Herrero\_Berme](#):
>
> So, i tried to use TSVB, and i can got both counts separated in the same graphic and grouped by months, but i can't combine them in an aggregation with Math function to calculate this Rate.

Would you mind sharing a screenshot of the data & panel options?

I think to search on multiple indices you can use an index pattern such as `indexOne,indexTwo`.

Have you tried with `Filter Ratio` aggregation?

---

<div class="post-metadata">

**Author:** ![Juanjo\_Herrero\_Berme](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/juanjo_herrero_berme/32/50275_2.png) [@Juanjo\_Herrero\_Berme](https://discuss.elastic.co/u/Juanjo_Herrero_Berme)\
**Post date:** [May 7, 2020, 11:43am UTC](https://discuss.elastic.co/t/how-to-calculate-combinating-different-index-with-different-mapping-in-order-to-show-a-histogram-in-kibana/230140/3 "2020-05-07T11:43:03Z")

</div>

Hi Luca!

Thanks you very much for your help, it was really useful.

I tried all the possibilites that you suggested and finally i got it.  
I think that TimeLion is the right way in order to make graphs or histogram with different index and with different mapping.

On the other hand, TSVB Ratio Filter allows it too, the only problem is that the index pattern must combine both index with different mapping, i mean, if you have a index called "index\_mapping\_1" and a index called "index\_mapping\_2", you must create a index pattern called "index\_mapping\*" or similar that includes both index names (its mapping will combine both index mapping"

I hope this can be useful for others.

See you!

---

<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:** [June 4, 2020, 11:47am UTC](https://discuss.elastic.co/t/how-to-calculate-combinating-different-index-with-different-mapping-in-order-to-show-a-histogram-in-kibana/230140/4 "2020-06-04T11:47:53Z")

</div>

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