# Ending aggregation with multiple conditions

**URL:** <https://discuss.elastic.co/t/ending-aggregation-with-multiple-conditions/73650>\
**Category:** Logstash\
**Created:** [February 2, 2017, 10:22am UTC](https://discuss.elastic.co/t/ending-aggregation-with-multiple-conditions/73650 "2017-02-02T10:22:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![egoldemberg](https://avatars.discourse-cdn.com/v4/letter/e/b19c9b/32.png) [@egoldemberg](https://discuss.elastic.co/u/egoldemberg)\
**Post date:** [February 2, 2017, 10:22am UTC](https://discuss.elastic.co/t/ending-aggregation-with-multiple-conditions/73650/1 "2017-02-02T10:22:47Z")

</div>

Hi,  
I'm trying to make an aggregation that will end when several phrases are seen, but I can't tell in advance their incoming order, and I want to wait for all of them to arrive (until a minimal timeout.)  
However, I don't want just to set a large timeout since I can wait too much time.  
I think the best way would be to dynamically set the checking inside the aggregation, something like:  
end\_of\_task =\> CheckIfShouldEndTask()  
But I think that's not going to work.

I had the same problem also with when to start the aggregation, but for that there is a solution.  
I set: map\_action =\> "create\_or\_update"  
so the aggregation begins when the earliest condition is met.  
Is there a good way to end aggregation when the latest condition is met?

Thanks.

---

<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:** [March 2, 2017, 10:22am UTC](https://discuss.elastic.co/t/ending-aggregation-with-multiple-conditions/73650/2 "2017-03-02T10:22:55Z")

</div>

Closed on March 2, 2017, 10:22am UTC

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