# Is this doable

**URL:** <https://discuss.elastic.co/t/is-this-doable/28611>\
**Category:** Elasticsearch\
**Created:** [September 3, 2015, 12:51pm UTC](https://discuss.elastic.co/t/is-this-doable/28611 "2015-09-03T12:51:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![84shalinisingh](https://avatars.discourse-cdn.com/v4/letter/8/f17d59/32.png) [@84shalinisingh](https://discuss.elastic.co/u/84shalinisingh)\
**Post date:** [September 3, 2015, 12:51pm UTC](https://discuss.elastic.co/t/is-this-doable/28611/1 "2015-09-03T12:51:36Z")

</div>

Hi All,

I am using elastic search 1.4.2.  
Data:  
State, City, Population  
LA, Shreveport, 10  
UT, Salt Lake City, 20  
TX, Houston, 30  
TX, Killeen, 60

I need to perform the following agregation;  
By City show me [sum city population] / [state population]

So for above data the result will be;  
**Shreveport** 1  
**Salt Lake City** 1  
**Houston** 0.33  
**Killeen** 0.67

---

<div class="post-metadata">

**Author:** ![84shalinisingh](https://avatars.discourse-cdn.com/v4/letter/8/f17d59/32.png) [@84shalinisingh](https://discuss.elastic.co/u/84shalinisingh)\
**Post date:** [September 4, 2015, 7:13am UTC](https://discuss.elastic.co/t/is-this-doable/28611/2 "2015-09-04T07:13:40Z")

</div>

I have looked at the different aggregations available with Elastic Search.  
But I assume this is currently not possible, as this requires aggregation at multi level ( for hierarchal data) and passing the result of one aggregation to another aggregation.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [September 4, 2015, 7:30am UTC](https://discuss.elastic.co/t/is-this-doable/28611/3 "2015-09-04T07:30:10Z")

</div>

May be [Pipeline aggs](https://www.elastic.co/guide/en/elasticsearch/reference/2.0/search-aggregations-pipeline.html) will help?

See also:

- [https://www.elastic.co/blog/staying-in-control-with-moving-averages-part-1](https://www.elastic.co/blog/staying-in-control-with-moving-averages-part-1)
- [https://www.elastic.co/blog/staying-in-control-with-moving-averages-part-2](https://www.elastic.co/blog/staying-in-control-with-moving-averages-part-2)

Hope this helps

---

<div class="post-metadata">

**Author:** ![84shalinisingh](https://avatars.discourse-cdn.com/v4/letter/8/f17d59/32.png) [@84shalinisingh](https://discuss.elastic.co/u/84shalinisingh)\
**Post date:** [September 4, 2015, 7:54am UTC](https://discuss.elastic.co/t/is-this-doable/28611/4 "2015-09-04T07:54:35Z")

</div>

> [@dadoonet](#):
>
> [Staying in Control with Moving Averages - Part 1 | Elastic Blog](https://www.elastic.co/blog/staying-in-control-with-moving-averages-part-1)

Thanks David for the reply!

I am using elasticsearch 1.4.2 and pipeline aggregation are part of 2.0 version which is still not released ( it is still in beta phase!).

I assume I will have to hold till than?

---

<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:** [July 5, 2017, 11:52pm UTC](https://discuss.elastic.co/t/is-this-doable/28611/5 "2017-07-05T23:52:06Z")

</div>


