# Is there any way to perform 2 different pipeline aggregation on a bucket aggregation

**URL:** <https://discuss.elastic.co/t/is-there-any-way-to-perform-2-different-pipeline-aggregation-on-a-bucket-aggregation/376701>\
**Category:** Elastic Search\
**Created:** [April 2, 2025, 2:57pm UTC](https://discuss.elastic.co/t/is-there-any-way-to-perform-2-different-pipeline-aggregation-on-a-bucket-aggregation/376701 "2025-04-02T14:57:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Salil\_Hardeniya](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/salil_hardeniya/32/141242_2.png) [@Salil\_Hardeniya](https://discuss.elastic.co/u/Salil_Hardeniya)\
**Post date:** [April 2, 2025, 2:57pm UTC](https://discuss.elastic.co/t/is-there-any-way-to-perform-2-different-pipeline-aggregation-on-a-bucket-aggregation/376701/1 "2025-04-02T14:57:26Z")

</div>

Hi,

I have created an elasticsearch aggregation with some heavy operation like script. Now I want to perform 2 different bucket sort on the result of the aggregation I did earlier. Is there any way I can do that?

I know I can write 2 aggreagtions but I want to avoid doing same initial aggregation twice for 2 different result.

---

<div class="post-metadata">

**Author:** ![Musab\_Dogan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/musab_dogan/32/70691_2.png) [@Musab\_Dogan](https://discuss.elastic.co/u/Musab_Dogan)\
**Post date:** [April 5, 2025, 9:45pm UTC](https://discuss.elastic.co/t/is-there-any-way-to-perform-2-different-pipeline-aggregation-on-a-bucket-aggregation/376701/2 "2025-04-05T21:45:21Z")

</div>

It'd be better if you can share the query, what you have tried so far, and the expected results.
