# Update existing document with fields from incoming document

**URL:** <https://discuss.elastic.co/t/update-existing-document-with-fields-from-incoming-document/92708>\
**Category:** Logstash\
**Created:** [July 11, 2017, 7:11pm UTC](https://discuss.elastic.co/t/update-existing-document-with-fields-from-incoming-document/92708 "2017-07-11T19:11:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_Clarke](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mike_clarke/32/87948_2.png) [@Mike\_Clarke](https://discuss.elastic.co/u/Mike_Clarke)\
**Post date:** [July 11, 2017, 7:11pm UTC](https://discuss.elastic.co/t/update-existing-document-with-fields-from-incoming-document/92708/1 "2017-07-11T19:11:52Z")

</div>

I have documents with known unique IDs (document\_id) in Elasticsearch. I am using Filebeat to ship to Logstash and then to Elasticsearch. I would like to add fields from documents of a certain type coming from Filebeat to existing documents in Elasticsearch if ref\_id field in incoming document is equal to the document\_id of an existing document. How can this be done?

For example I have a document that has a state associated with it. A separate file contains state changes and a state date. Ultimately, I would only make the change to the existing documents fields if the state date is newer than the state date of the state already in the document.

---

<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:** [August 8, 2017, 7:11pm UTC](https://discuss.elastic.co/t/update-existing-document-with-fields-from-incoming-document/92708/2 "2017-08-08T19:11:58Z")

</div>

Closed on August 8, 2017, 7:11pm UTC

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