# How to get percentage aggregation?

**URL:** https://discuss.elastic.co/t/how-to-get-percentage-aggregation/63415
**Category:** Elasticsearch
**Created:** [October 19, 2016, 3:22pm UTC](https://discuss.elastic.co/t/how-to-get-percentage-aggregation/63415 "2016-10-19T15:22:01Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![frederes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/frederes/32/12476_2.png) [@frederes](https://discuss.elastic.co/u/frederes)
#### Post date: [October 19, 2016, 3:22pm UTC](https://discuss.elastic.co/t/how-to-get-percentage-aggregation/63415/1 "2016-10-19T15:22:01Z")

</div>

I don't find the way to get percentage in each bucket of an aggregation.  
How does Elastic handle percentage calculation ?

---

<div class="post-metadata">

### Author: ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)
#### Post date: [October 19, 2016, 4:45pm UTC](https://discuss.elastic.co/t/how-to-get-percentage-aggregation/63415/2 "2016-10-19T16:45:00Z")

</div>

Percentage of what?

Depending on what you need, a [bucket script pipeline agg](https://www.elastic.co/guide/en/elasticsearch/reference/2.4/search-aggregations-pipeline-bucket-script-aggregation.html) may work, although it has limitations.

If you just want to convert a raw double (`0.01`) to a percentage (`1%`), I'm afraid this isn't currently possible... you'll have to do the conversion in your application.

---

<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, 10:11pm UTC](https://discuss.elastic.co/t/how-to-get-percentage-aggregation/63415/3 "2017-07-05T22:11:09Z")

</div>


