# Aggregate filter only works sometimes, randomly doesn't work

**URL:** <https://discuss.elastic.co/t/aggregate-filter-only-works-sometimes-randomly-doesnt-work/82201>\
**Category:** Logstash\
**Created:** [April 12, 2017, 4:59pm UTC](https://discuss.elastic.co/t/aggregate-filter-only-works-sometimes-randomly-doesnt-work/82201 "2017-04-12T16:59:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![brandono](https://avatars.discourse-cdn.com/v4/letter/b/439d5e/32.png) [@brandono](https://discuss.elastic.co/u/brandono)\
**Post date:** [April 12, 2017, 4:59pm UTC](https://discuss.elastic.co/t/aggregate-filter-only-works-sometimes-randomly-doesnt-work/82201/1 "2017-04-12T16:59:50Z")

</div>

Hi,

I'm using the aggregate function to sum together groups of lines coming from a CSV. I am using push\_previous\_map\_as\_event =\> true to handle the rows. All rows are grouped by a unique name, and are in the correct format required for this method (Rows are ordered in csv by unique name).

> aggregate {  
> task\_id =\> "%{name}"  
> code =\> "  
> map['name'] = event.get('name')  
> map['aggusablecapacity'] ||=0; map['aggusablecapacity'] += event.get('usablecapacity')  
> map['aggconsumedcapacity'] ||=0; map['aggconsumedcapacity'] += event.get('consumedcapacity')  
> map['aggavailablecapacity'] ||=0; map['aggavailablecapacity'] += event.get('availablecapacity')  
> event.cancel()"  
> push\_previous\_map\_as\_event =\> true  
> timeout=\> 5  
> }

So here is the issue, this section works maybe 70-90% of the time, seemingly randomly. Every time I run it, some events are grouped correctly, and some are not. There doesn't seem to be any pattern as to which groups are incorrectly passed through to the output each time I run it. When a group is incorrectly passed through, it returns multiple rows of the same unique name, as they appear in the CSV.

---

<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:** [May 10, 2017, 5:07pm UTC](https://discuss.elastic.co/t/aggregate-filter-only-works-sometimes-randomly-doesnt-work/82201/2 "2017-05-10T17:07:38Z")

</div>

Closed on May 10, 2017, 5:07pm UTC

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