# Applying Bucket aggregation to the output of Pipeline aggregation

**URL:** <https://discuss.elastic.co/t/applying-bucket-aggregation-to-the-output-of-pipeline-aggregation/197040>\
**Category:** Elasticsearch\
**Created:** [August 28, 2019, 6:24am UTC](https://discuss.elastic.co/t/applying-bucket-aggregation-to-the-output-of-pipeline-aggregation/197040 "2019-08-28T06:24:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![G-K-Patel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/g-k-patel/32/53143_2.png) [@G-K-Patel](https://discuss.elastic.co/u/G-K-Patel)\
**Post date:** [August 28, 2019, 6:24am UTC](https://discuss.elastic.co/t/applying-bucket-aggregation-to-the-output-of-pipeline-aggregation/197040/1 "2019-08-28T06:24:51Z")

</div>

Hi all ES lovers,

I was wondering if it is somehow possible to apply bucket aggregation to the output of a pipeline aggregation.

I have the following usecase,

There is a software that runs over variable amount of time and generates logs, and each run has a unique ID. Using this ID, I can figure out the start (min aggregation on Timestamp) and stop (max aggregation on Timestamp) of the software run, and thereby the duration of run can be calculated in a sibling pipeline aggregation (stop-start). After doing this, is it possible to apply a bucket aggregation on the duration, to generate a histogram for visualizing the distribution of duration ?

Can such a thing be achieved using painless scripting or any other methods ?

Thank you all for your reply.

---

<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:** [September 25, 2019, 6:24am UTC](https://discuss.elastic.co/t/applying-bucket-aggregation-to-the-output-of-pipeline-aggregation/197040/2 "2019-09-25T06:24:55Z")

</div>

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