# How to get "top N + remainder"?

**URL:** https://discuss.elastic.co/t/how-to-get-top-n-remainder/40102
**Category:** Elasticsearch
**Created:** [January 26, 2016, 8:56am UTC](https://discuss.elastic.co/t/how-to-get-top-n-remainder/40102 "2016-01-26T08:56:46Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![skundrik](https://avatars.discourse-cdn.com/v4/letter/s/c6cbf5/32.png) [@skundrik](https://discuss.elastic.co/u/skundrik)
#### Post date: [January 26, 2016, 8:56am UTC](https://discuss.elastic.co/t/how-to-get-top-n-remainder/40102/1 "2016-01-26T08:56:46Z")

</div>

I'd like to have a pie chart with top 5 items but it would be lot more useful if I could also see all the rest of the data as 1 big "the rest" slice.

Anyone knows if this is possible?

---

<div class="post-metadata">

### Author: ![whybangbang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/whybangbang/32/7116_2.png) [@whybangbang](https://discuss.elastic.co/u/whybangbang)
#### Post date: [January 26, 2016, 11:06am UTC](https://discuss.elastic.co/t/how-to-get-top-n-remainder/40102/2 "2016-01-26T11:06:12Z")

</div>

do you use kibana, pip chart set descending ,if you use elasticsearch agg,you can set "size" paramter

---

<div class="post-metadata">

### Author: ![skundrik](https://avatars.discourse-cdn.com/v4/letter/s/c6cbf5/32.png) [@skundrik](https://discuss.elastic.co/u/skundrik)
#### Post date: [January 26, 2016, 12:15pm UTC](https://discuss.elastic.co/t/how-to-get-top-n-remainder/40102/3 "2016-01-26T12:15:03Z")

</div>

Yes, that gets me the top N but how do you the remainder? (i.e. top 3 count and the count for rest of the terms). It's useful when you want to see how big proportion of the total volume the top N is.

---

<div class="post-metadata">

### Author: ![whybangbang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/whybangbang/32/7116_2.png) [@whybangbang](https://discuss.elastic.co/u/whybangbang)
#### Post date: [January 27, 2016, 4:40am UTC](https://discuss.elastic.co/t/how-to-get-top-n-remainder/40102/4 "2016-01-27T04:40:34Z")

</div>

kibana don't contain this function but es support it,i think you can submit a issue to discuss

---

<div class="post-metadata">

### Author: ![skundrik](https://avatars.discourse-cdn.com/v4/letter/s/c6cbf5/32.png) [@skundrik](https://discuss.elastic.co/u/skundrik)
#### Post date: [February 1, 2016, 4:32pm UTC](https://discuss.elastic.co/t/how-to-get-top-n-remainder/40102/5 "2016-02-01T16:32:44Z")

</div>

Does anyone know how to do this just using ES REST API?

---

<div class="post-metadata">

### Author: ![whybangbang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/whybangbang/32/7116_2.png) [@whybangbang](https://discuss.elastic.co/u/whybangbang)
#### Post date: [February 3, 2016, 2:34am UTC](https://discuss.elastic.co/t/how-to-get-top-n-remainder/40102/6 "2016-02-03T02:34:46Z")

</div>

sorry i don't know,somebody re-develop kibana ,i suggest maybe you can review kibana code:grinning:

---

<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:19pm UTC](https://discuss.elastic.co/t/how-to-get-top-n-remainder/40102/7 "2017-07-05T23:19:23Z")

</div>


