# Trying to save the last data for parameter X aggregated on field UID

**URL:** <https://discuss.elastic.co/t/trying-to-save-the-last-data-for-parameter-x-aggregated-on-field-uid/99719>\
**Category:** Elasticsearch\
**Created:** [September 7, 2017, 12:24pm UTC](https://discuss.elastic.co/t/trying-to-save-the-last-data-for-parameter-x-aggregated-on-field-uid/99719 "2017-09-07T12:24:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomer](https://avatars.discourse-cdn.com/v4/letter/t/41988e/32.png) [@tomer](https://discuss.elastic.co/u/tomer)\
**Post date:** [September 7, 2017, 12:24pm UTC](https://discuss.elastic.co/t/trying-to-save-the-last-data-for-parameter-x-aggregated-on-field-uid/99719/1 "2017-09-07T12:24:10Z")

</div>

Hi,  
I am trying to save the last data for parameter X aggregated on field transactionId using:

```
  aggregate {
		task_id => "%{transactionId}"
		code => "
			if (event.get('SRI_sent').eql? '0')
				event.set('SRI_sent', map['SRI_sent'])
			end
			event.set('cdrType', 'aggregated')
			"
		push_map_as_event_on_timeout => true
		timeout_task_id_field => "transactionId"
		timeout => 100
    
   }

```

This does not work all that SRI\_sent is 0 does not get the last value but gets nil, the last log with the same transactionId has '0' in the SRI\_sent field.  
How can I save the information to the last log?

---

<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:** [October 5, 2017, 12:24pm UTC](https://discuss.elastic.co/t/trying-to-save-the-last-data-for-parameter-x-aggregated-on-field-uid/99719/2 "2017-10-05T12:24:16Z")

</div>

Closed on October 5, 2017, 12:24pm UTC

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