# How to update a index based on fields other than the document\_id using logstash?

**URL:** <https://discuss.elastic.co/t/how-to-update-a-index-based-on-fields-other-than-the-document-id-using-logstash/133481>\
**Category:** Logstash\
**Created:** [May 28, 2018, 7:35am UTC](https://discuss.elastic.co/t/how-to-update-a-index-based-on-fields-other-than-the-document-id-using-logstash/133481 "2018-05-28T07:35:33Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![guyboertje](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/guyboertje/32/31592_2.png) [@guyboertje](https://discuss.elastic.co/u/guyboertje)\
**Post date:** [May 30, 2018, 10:30am UTC](https://discuss.elastic.co/t/how-to-update-a-index-based-on-fields-other-than-the-document-id-using-logstash/133481/4 "2018-05-30T10:30:46Z")

</div>

Maybe scripted updates in the elasticsearch output might work for you?

> [@Using script params - elasticsearch output plugin](https://discuss.elastic.co/t/using-script-params-elasticsearch-output-plugin/71693):
>
> Hello, I was trying to use [script params in scripted updates](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html#_scripted_updates) in the elasticsearch output plugin of logstash but I was unsure of how to do it. Currently, we two types of scripted updates: script\_lang =\> "painless" script\_type =\> "inline" script =\> ' ctx.\_source.name\_servers = "%{name\_servers}"; ctx.\_source.past\_name\_servers.add("%{past\_name\_servers}"); ' Where my event has f…

This would be in a second LS pipeline that reads the CSV file. Be aware that the document you are trying to update must be in ES already. You may need to use the elasticsearch filter to add the sequence\_id of the first doc matching against order\_id. Alternatively you could try to add an array of sequence\_id of all matching docs by order\_id and then split the array into multiple docs.

---

_[View the full topic](https://discuss.elastic.co/t/how-to-update-a-index-based-on-fields-other-than-the-document-id-using-logstash/133481)._
