# How to get the one document's field and update with another document's fields\[transfer the field's value from one event to another event\]

**URL:** <https://discuss.elastic.co/t/how-to-get-the-one-documents-field-and-update-with-another-documents-fields-transfer-the-fields-value-from-one-event-to-another-event/183498>\
**Category:** Logstash\
**Created:** [May 30, 2019, 9:22am UTC](https://discuss.elastic.co/t/how-to-get-the-one-documents-field-and-update-with-another-documents-fields-transfer-the-fields-value-from-one-event-to-another-event/183498 "2019-05-30T09:22:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Md\_Iburahimsha\_S](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/md_iburahimsha_s/32/47142_2.png) [@Md\_Iburahimsha\_S](https://discuss.elastic.co/u/Md_Iburahimsha_S)\
**Post date:** [May 30, 2019, 9:22am UTC](https://discuss.elastic.co/t/how-to-get-the-one-documents-field-and-update-with-another-documents-fields-transfer-the-fields-value-from-one-event-to-another-event/183498/1 "2019-05-30T09:22:28Z")

</div>

I have a requirement to update the one document field based on the another document example \_id : 5 doesn't has any field like "risk", but another \_id : 4 has a field risk =\> high . \_id=\> 4 is the 1st event and followed by \_id:5 is creating. So i have to get the \_id=\> 4 risk field and update to \_id:5 (create a new field and update). Only relation between these two document is one common field example \_id 4 and 5 has the field sessionName=\> "auth12332232". based on the common field i have to map. note: numerical value in session name is dynamic .

---

<div class="post-metadata">

**Author:** ![Md\_Iburahimsha\_S](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/md_iburahimsha_s/32/47142_2.png) [@Md\_Iburahimsha\_S](https://discuss.elastic.co/u/Md_Iburahimsha_S)\
**Post date:** [May 30, 2019, 8:03pm UTC](https://discuss.elastic.co/t/how-to-get-the-one-documents-field-and-update-with-another-documents-fields-transfer-the-fields-value-from-one-event-to-another-event/183498/2 "2019-05-30T20:03:31Z")

</div>

I've found the solution with help of Aggregate filter. Based on the common field i have set the task id and create the field one on 1st event and Closed on matched next event(i.e end the aggregate task, in my case only two events possible, hence i have closed once its matched). Here no need to worry about that Doc id. Any other great solutions are invited if any. Thanks !

Note: Before using Aggregate filter, make sure this plugin should installed in the machine.

Doc Referred:  
[https://www.elastic.co/guide/en/logstash/5.3/plugins-filters-aggregate.html#plugins-filters-aggregate](https://www.elastic.co/guide/en/logstash/5.3/plugins-filters-aggregate.html#plugins-filters-aggregate)

Refer for other USECASES:  
[https://www.elastic.co/guide/en/logstash/5.3/plugins-filters-aggregate.html#\_use\_cases](https://www.elastic.co/guide/en/logstash/5.3/plugins-filters-aggregate.html#_use_cases)

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [May 31, 2019, 12:01am UTC](https://discuss.elastic.co/t/how-to-get-the-one-documents-field-and-update-with-another-documents-fields-transfer-the-fields-value-from-one-event-to-another-event/183498/3 "2019-05-31T00:01:38Z")

</div>

> [@Md\_Iburahimsha\_S](#):
>
> Any other great solutions are invited if any.

If you are trying to combine two events based on a field that they have in common then an aggregate filter is the way to go.

---

<div class="post-metadata">

**Author:** ![Md\_Iburahimsha\_S](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/md_iburahimsha_s/32/47142_2.png) [@Md\_Iburahimsha\_S](https://discuss.elastic.co/u/Md_Iburahimsha_S)\
**Post date:** [May 31, 2019, 11:09am UTC](https://discuss.elastic.co/t/how-to-get-the-one-documents-field-and-update-with-another-documents-fields-transfer-the-fields-value-from-one-event-to-another-event/183498/4 "2019-05-31T11:09:38Z")

</div>

Thanks for the suggestion !!!. 🙂

---

<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:** [June 28, 2019, 11:24am UTC](https://discuss.elastic.co/t/how-to-get-the-one-documents-field-and-update-with-another-documents-fields-transfer-the-fields-value-from-one-event-to-another-event/183498/5 "2019-06-28T11:24:08Z")

</div>

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