# Query two separate indices, perform calculations on the results, graph result of calculation

**URL:** <https://discuss.elastic.co/t/query-two-separate-indices-perform-calculations-on-the-results-graph-result-of-calculation/279292>\
**Category:** Kibana\
**Created:** [July 21, 2021, 5:18pm UTC](https://discuss.elastic.co/t/query-two-separate-indices-perform-calculations-on-the-results-graph-result-of-calculation/279292 "2021-07-21T17:18:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![eeijlar](https://avatars.discourse-cdn.com/v4/letter/e/96bed5/32.png) [@eeijlar](https://discuss.elastic.co/u/eeijlar)\
**Post date:** [July 21, 2021, 5:18pm UTC](https://discuss.elastic.co/t/query-two-separate-indices-perform-calculations-on-the-results-graph-result-of-calculation/279292/1 "2021-07-21T17:18:49Z")

</div>

I would like to query two separate indices.

I would like to do the following:

Query 1: Query metricbeat which returns a figure say for arguments sake 2,500,000. I would like to divide this by 1,000,000 which gives me a values of 2.5

Query 2: Query custom index which returns a value of 8000.

Calculate: Divide result of query 2 (8000) by the result of query 1 + calculation (2.5)

Graph: Graph the resulting value

Is this possible in Kibana? In any of the options I have looked at Lens and TSVB, this doesn't seem possible. In Lens, I can't use a Bucket Script on the queries. In TSVB I can't query more than a single index.

---

<div class="post-metadata">

**Author:** ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)\
**Post date:** [July 21, 2021, 5:24pm UTC](https://discuss.elastic.co/t/query-two-separate-indices-perform-calculations-on-the-results-graph-result-of-calculation/279292/2 "2021-07-21T17:24:47Z")

</div>

Hi, this is one of the features we track in our [supported features by panel type](https://www.elastic.co/guide/en/kibana/7.13/aggregation-reference.html#other-features) document. As you can see, the only options you have for this are TImelion and Vega.

You may be interested to know that [Lens in 7.14](https://www.elastic.co/guide/en/kibana/7.14/aggregation-reference.html#other-features) will support some important use cases that were previously TSVB-only.

---

<div class="post-metadata">

**Author:** ![eeijlar](https://avatars.discourse-cdn.com/v4/letter/e/96bed5/32.png) [@eeijlar](https://discuss.elastic.co/u/eeijlar)\
**Post date:** [July 21, 2021, 5:28pm UTC](https://discuss.elastic.co/t/query-two-separate-indices-perform-calculations-on-the-results-graph-result-of-calculation/279292/3 "2021-07-21T17:28:46Z")

</div>

@wylie : thanks for your answer! Do you think it's possible in Vega? I kind of thought Vega looked like a possibility.

---

<div class="post-metadata">

**Author:** ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)\
**Post date:** [July 21, 2021, 5:47pm UTC](https://discuss.elastic.co/t/query-two-separate-indices-perform-calculations-on-the-results-graph-result-of-calculation/279292/4 "2021-07-21T17:47:59Z")

</div>

Yes, Vega is capable of doing this.

---

<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 18, 2021, 5:48pm UTC](https://discuss.elastic.co/t/query-two-separate-indices-perform-calculations-on-the-results-graph-result-of-calculation/279292/5 "2021-08-18T17:48:04Z")

</div>

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