# Logstash Update a document in elasticsearch

**URL:** https://discuss.elastic.co/t/logstash-update-a-document-in-elasticsearch/74039
**Category:** Logstash
**Created:** [February 6, 2017, 10:12am UTC](https://discuss.elastic.co/t/logstash-update-a-document-in-elasticsearch/74039 "2017-02-06T10:12:41Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![pjanzen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pjanzen/32/13756_2.png) [@pjanzen](https://discuss.elastic.co/u/pjanzen)
#### Post date: [February 6, 2017, 10:31am UTC](https://discuss.elastic.co/t/logstash-update-a-document-in-elasticsearch/74039/5 "2017-02-06T10:31:28Z")

</div>

EDIT: I for to mention that you need to generate your own document\_id and set that. So in order to update a existing document you need to set a id on the initial document and reuse that. (bad example: ie: email\_address) or query ES for the document\_id using the logstash-filter-elasticsearch plugin.

It will look something like this.

```
output {
    elasticsearch {
        host => 'your es host'
        action => 'update'
        document_id => 'your generated document id'
        index => 'your index name
    }
}

```

[https://www.elastic.co/guide/en/logstash/current/plugins-outputs-elasticsearch.html#plugins-outputs-elasticsearch-action](https://www.elastic.co/guide/en/logstash/current/plugins-outputs-elasticsearch.html#plugins-outputs-elasticsearch-action)

---

_[View the full topic](https://discuss.elastic.co/t/logstash-update-a-document-in-elasticsearch/74039)._
