# How to update Mulitple Documents of an index using logstash?

**URL:** <https://discuss.elastic.co/t/how-to-update-mulitple-documents-of-an-index-using-logstash/105613>\
**Category:** Logstash\
**Created:** [October 27, 2017, 8:20pm UTC](https://discuss.elastic.co/t/how-to-update-mulitple-documents-of-an-index-using-logstash/105613 "2017-10-27T20:20:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MariumHassan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mariumhassan/32/30321_2.png) [@MariumHassan](https://discuss.elastic.co/u/MariumHassan)\
**Post date:** [October 27, 2017, 8:20pm UTC](https://discuss.elastic.co/t/how-to-update-mulitple-documents-of-an-index-using-logstash/105613/1 "2017-10-27T20:20:18Z")

</div>

Hi all,  
I want to update multiple documents when I get a log with the status "FILE\_PROCESSING\_ERROR". I have set document ids. I have also stored some relevant ids.  
In the output plugin I have done something like this to update status field in my document:

```auto
if [status] == "FILE_PROCESSING_ERROR"
  {
  #elasticsearch port 9200                
    elasticsearch 
    { 
      hosts => ["localhost:9200"] 
      index => "timeline-%{+YYYY-MM-dd}" 
      action => "update"
      doc_as_upsert => true
      script_lang => "painless"
      script_type => "inline"
      script => 'ctx._source.status = "Order Failed"'
      document_id => "ODW1873109"    
    }
  }

```

where "ODW1873109" is the document id which I have stored.Please suggest me any way to get it done. I want something like this:

```auto
 ruby
    {
     code => " for i in 0..5
     {
      elasticsearch 
      { 
       # update all the logs with documents ids stored in map
      }
     }
   }

```

Basically, multiple documents of logs need to be updated in my case.

Any help will be really appreciated in this matter. Thanks in anticipation!

---

<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:** [November 24, 2017, 8:20pm UTC](https://discuss.elastic.co/t/how-to-update-mulitple-documents-of-an-index-using-logstash/105613/2 "2017-11-24T20:20:33Z")

</div>

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