# Grouping similar buckets

**URL:** <https://discuss.elastic.co/t/grouping-similar-buckets/272068>\
**Category:** Elasticsearch\
**Created:** [May 4, 2021, 12:33pm UTC](https://discuss.elastic.co/t/grouping-similar-buckets/272068 "2021-05-04T12:33:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gregorkosmina](https://avatars.discourse-cdn.com/v4/letter/g/3ab097/32.png) [@Gregorkosmina](https://discuss.elastic.co/u/Gregorkosmina)\
**Post date:** [May 4, 2021, 12:33pm UTC](https://discuss.elastic.co/t/grouping-similar-buckets/272068/1 "2021-05-04T12:33:06Z")

</div>

My aggregations buckets are sorted by doc\_count at the moment. I would like to group them by similar buckets (e.g 40 km/h, 50 km/h, 60 km/h) even if doc\_count is different. Is this even possible?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [May 10, 2021, 9:14am UTC](https://discuss.elastic.co/t/grouping-similar-buckets/272068/2 "2021-05-10T09:14:57Z")

</div>

Hey,

can you add some more context around that request? Maybe provide a fully fledged example document, this way it might be easier to follow what you are after. You can sort aggregation buckets by different factors than just the doc count.

--Alex

---

<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:** [June 7, 2021, 9:15am UTC](https://discuss.elastic.co/t/grouping-similar-buckets/272068/3 "2021-06-07T09:15:54Z")

</div>

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