# Timelion aggregation- Possible with terms?

**URL:** <https://discuss.elastic.co/t/timelion-aggregation-possible-with-terms/98271>\
**Category:** Kibana\
**Tags:** timelion\
**Created:** [August 24, 2017, 5:31pm UTC](https://discuss.elastic.co/t/timelion-aggregation-possible-with-terms/98271 "2017-08-24T17:31:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lindsey](https://avatars.discourse-cdn.com/v4/letter/l/da6949/32.png) [@Lindsey](https://discuss.elastic.co/u/Lindsey)\
**Post date:** [August 24, 2017, 5:31pm UTC](https://discuss.elastic.co/t/timelion-aggregation-possible-with-terms/98271/1 "2017-08-24T17:31:38Z")

</div>

Hey Guys!

Im trying to graph a formula using add, divide and multiple functions of Timeline. I wanted to know if it was possible, and if so how to add aggregation of terms to my Timeline equation.

Right now, what I think I have is adding 3 different values together in the same index.

A+B+C:

.es(index=indexWanted\*, q=termSpecifyingWhatSectionIwant:sub111a-ion, metric="sum:valueOneThatiWantToAddTogether").sum(.es(index=indexWanted\*, q=termSpecifyingWhatSectionIwantr:sub222-ion, metric="sum:valueTwoThatiWantToAddTogether").sum(.es(index=indexWanted\*, q=termSpecifyingWhatSectionIwantr:sub333-ion, metric="sum:valueThreeThatiWantToAddTogether")

I have a few meters reading in data, and I want to find the total value passing these meters together, but I have a few meters in the system Id like to keep out, which is why I can't just take the sum off all sub\*

Thank you in advance!

---

<div class="post-metadata">

**Author:** ![jbudz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jbudz/32/45922_2.png) [@jbudz](https://discuss.elastic.co/u/jbudz)\
**Post date:** [August 24, 2017, 7:35pm UTC](https://discuss.elastic.co/t/timelion-aggregation-possible-with-terms/98271/2 "2017-08-24T19:35:45Z")

</div>

You can do a terms aggregation on the first query and then do a sum on top, but it won't let you do two splits and add them back together - the data may not line up after.

If the first option works for you it would look something like  
`.es(index=foo-*, split=my_field:5).......`. The number proceeding my\_field is the number of terms.

if that doesn't work for you, can you share a little more about what you're trying to do? It might be worth looking into a different approach. Can you filter out the meters with a query instead of subtracting?

---

<div class="post-metadata">

**Author:** ![Lindsey](https://avatars.discourse-cdn.com/v4/letter/l/da6949/32.png) [@Lindsey](https://discuss.elastic.co/u/Lindsey)\
**Post date:** [August 24, 2017, 9:11pm UTC](https://discuss.elastic.co/t/timelion-aggregation-possible-with-terms/98271/3 "2017-08-24T21:11:23Z")

</div>

Hey Jon,

My formula uses many different terms (data.meter)'s value (data.datum) example of one:

t \_type Index\_wanted  
'# data.datum 777  
t data.meter sub11a-ion

I want to use the data.datum value for the following equation, which means that I need to get the data.datum values from different terms. (Not sure if I am using the correct lingo)

(sub1 +sub2 +sub5+ sub32 + sub108 -(sub20 through sub30)(total power))/ (total load)

I don't actually want to split anything, because all these data points will go into the above equation, which will make a point and go onto the timelion graph ( in theory at least)!  
Cheers,  
Lindsey

---

<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 21, 2017, 9:11pm UTC](https://discuss.elastic.co/t/timelion-aggregation-possible-with-terms/98271/4 "2017-09-21T21:11:39Z")

</div>

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