# Aggregation buckets custom order

**URL:** <https://discuss.elastic.co/t/aggregation-buckets-custom-order/291838>\
**Category:** Elasticsearch\
**Created:** [December 14, 2021, 4:24pm UTC](https://discuss.elastic.co/t/aggregation-buckets-custom-order/291838 "2021-12-14T16:24:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmoreram](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mmoreram/32/87391_2.png) [@mmoreram](https://discuss.elastic.co/u/mmoreram)\
**Post date:** [December 14, 2021, 4:24pm UTC](https://discuss.elastic.co/t/aggregation-buckets-custom-order/291838/1 "2021-12-14T16:24:09Z")

</div>

I'd like to define by hand the order of a term aggregation. Of course, these values should appear only when they are part of the result. Is there a way this can be done?

Custom agg1 (x)  
Custom agg2 (x)  
Other1 (x)  
Other2 (x)

---

<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:** [January 11, 2022, 4:25pm UTC](https://discuss.elastic.co/t/aggregation-buckets-custom-order/291838/2 "2022-01-11T16:25:09Z")

</div>

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