# Aggregate filter check value with all previous records

**URL:** https://discuss.elastic.co/t/aggregate-filter-check-value-with-all-previous-records/91311
**Category:** Logstash
**Created:** [June 29, 2017, 3:15pm UTC](https://discuss.elastic.co/t/aggregate-filter-check-value-with-all-previous-records/91311 "2017-06-29T15:15:54Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Tejas\_Ghutukade](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@Tejas\_Ghutukade](https://discuss.elastic.co/u/Tejas_Ghutukade)
#### Post date: [June 29, 2017, 3:15pm UTC](https://discuss.elastic.co/t/aggregate-filter-check-value-with-all-previous-records/91311/1 "2017-06-29T15:15:55Z")

</div>

while reading the csv file in logstash i want to compare value with all the previous record and depending on the condition set a field with true or false.  
m able to compare with the immediate previous record but i want check for all the previous record.  
Is it possible to do using aggregate filter ?

here's my current aggregate filter

```
 aggregate {
	task_id => "%{odr}"
	code => "
	map['dur'] ||= event.get('endtime');
	event.set('isCc', (event.get('starttime') < map['dur'])?1:0);
	map['dur'] = event.get('endtime');
	"
	push_map_as_event_on_timeout => true
	timeout_task_id_field => "odr"
	timeout => 30
	timeout_tags => ['_aggregatetimeout']
	timeout_code => ""
}

```

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: [July 27, 2017, 3:15pm UTC](https://discuss.elastic.co/t/aggregate-filter-check-value-with-all-previous-records/91311/2 "2017-07-27T15:15:58Z")

</div>

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