# How to Update multiple Elastic search Documents from Logstash Output Plugin

**URL:** <https://discuss.elastic.co/t/how-to-update-multiple-elastic-search-documents-from-logstash-output-plugin/142091>\
**Category:** Logstash\
**Created:** [July 30, 2018, 5:21am UTC](https://discuss.elastic.co/t/how-to-update-multiple-elastic-search-documents-from-logstash-output-plugin/142091 "2018-07-30T05:21:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arjun](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@Arjun](https://discuss.elastic.co/u/Arjun)\
**Post date:** [July 30, 2018, 5:21am UTC](https://discuss.elastic.co/t/how-to-update-multiple-elastic-search-documents-from-logstash-output-plugin/142091/1 "2018-07-30T05:21:02Z")

</div>

My logstash event have a column with array of document IDs to be update - column name :: "listOfDocumentIds".  
How to iterate over the array and update multiple documents in elastic search.  
Below is the code I used to update one record.

output{  
elasticsearch {  
hosts =\> ["{host-name}:9200"]  
index =\> "elasticsearchinlogstashindex"  
action =\> "update"  
document\_id =\> "%{[listOfDocumentIds][0]}"  
script =\> "ctx.\_source.callsOverlapped='Yes';"  
script\_lang =\> "painless"  
}  
}

Instead of hard coding the index value in the above piece of code - document\_id =\> "%{[listOfDocumentIds][0]}" I need to iterate over the size and update the documents in elastic search.

---

<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 27, 2018, 5:21am UTC](https://discuss.elastic.co/t/how-to-update-multiple-elastic-search-documents-from-logstash-output-plugin/142091/2 "2018-08-27T05:21:15Z")

</div>

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