# Sum of the merits from two indexes - timelion query

**URL:** <https://discuss.elastic.co/t/sum-of-the-merits-from-two-indexes-timelion-query/165911>\
**Category:** Kibana\
**Tags:** timelion\
**Created:** [January 27, 2019, 3:13pm UTC](https://discuss.elastic.co/t/sum-of-the-merits-from-two-indexes-timelion-query/165911 "2019-01-27T15:13:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anna\_F](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@Anna\_F](https://discuss.elastic.co/u/Anna_F)\
**Post date:** [January 27, 2019, 3:13pm UTC](https://discuss.elastic.co/t/sum-of-the-merits-from-two-indexes-timelion-query/165911/1 "2019-01-27T15:13:39Z")

</div>

After making the following query in timelion, on one graph I have two lines presenting data.

```auto
.es(index='int_20190108', timefield='dt_receipt', metric='sum:ch_id', q='channel:tnthd'),.es(index='test_20190108', timefield='dt_receipt', metric='sum:ch_id', q='channel:tnt')

```

Now I want to sum them up and I should have one line on the graph, which will sum up the data from these two queries. Is there any possibility of sum values ​​from two indices.

We have two channel names so we want to sum up the value 'tnthd' from the index 'int\_20190108' with the value 'tnt' from the index 'test\_20190108'

---

<div class="post-metadata">

**Author:** ![Larry\_Gregory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/larry_gregory/32/34969_2.png) [@Larry\_Gregory](https://discuss.elastic.co/u/Larry_Gregory)\
**Post date:** [January 28, 2019, 1:03pm UTC](https://discuss.elastic.co/t/sum-of-the-merits-from-two-indexes-timelion-query/165911/2 "2019-01-28T13:03:39Z")

</div>

@Anna_F,

Does using the `.plus` function give you what you're looking for?

```auto
.es(index='int_20190108', timefield='dt_receipt', metric='sum:ch_id', q='channel:tnthd').plus(series=.es(index='test_20190108', timefield='dt_receipt', metric='sum:ch_id', q='channel:tnt'))

```

---

<div class="post-metadata">

**Author:** ![Anna\_F](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@Anna\_F](https://discuss.elastic.co/u/Anna_F)\
**Post date:** [February 7, 2019, 7:04pm UTC](https://discuss.elastic.co/t/sum-of-the-merits-from-two-indexes-timelion-query/165911/3 "2019-02-07T19:04:53Z")

</div>

Yes thanks, I used .sum() - it works too:)

---

<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:** [March 7, 2019, 7:05pm UTC](https://discuss.elastic.co/t/sum-of-the-merits-from-two-indexes-timelion-query/165911/4 "2019-03-07T19:05:00Z")

</div>

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