# Is it possible to update an index by importing an updated .csv file?

**URL:** <https://discuss.elastic.co/t/is-it-possible-to-update-an-index-by-importing-an-updated-csv-file/292029>\
**Category:** Logstash\
**Created:** [December 15, 2021, 5:39pm UTC](https://discuss.elastic.co/t/is-it-possible-to-update-an-index-by-importing-an-updated-csv-file/292029 "2021-12-15T17:39:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kibanauser4](https://avatars.discourse-cdn.com/v4/letter/k/ecd19e/32.png) [@kibanauser4](https://discuss.elastic.co/u/kibanauser4)\
**Post date:** [December 15, 2021, 5:39pm UTC](https://discuss.elastic.co/t/is-it-possible-to-update-an-index-by-importing-an-updated-csv-file/292029/1 "2021-12-15T17:39:47Z")

</div>

I want to update my index by importing a .csv file via Logstash. Currently, the plan is to delete all the records from the index and then reimport the new .csv file from scratch. But I was wondering if it's possible to just update the index by importing the updated .csv file without deleting the records?

---

<div class="post-metadata">

**Author:** ![yaauie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yaauie/32/23363_2.png) [@yaauie](https://discuss.elastic.co/u/yaauie)\
**Post date:** [December 15, 2021, 8:35pm UTC](https://discuss.elastic.co/t/is-it-possible-to-update-an-index-by-importing-an-updated-csv-file/292029/2 "2021-12-15T20:35:24Z")

</div>

If your initial import provided document ids, and did not rely on Elasticsearch generating document ids for you, then this can be done by routing to the same index and providing the Elasticsearch output with both `document_id` and [`action => update`](https://www.elastic.co/guide/en/logstash/current/plugins-outputs-elasticsearch.html#plugins-outputs-elasticsearch-action) (and possibly [`doc_as_upsert => true`](https://www.elastic.co/guide/en/logstash/current/plugins-outputs-elasticsearch.html#plugins-outputs-elasticsearch-doc_as_upsert), depending on how you want to handle new records).

---

<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:** [January 12, 2022, 8:36pm UTC](https://discuss.elastic.co/t/is-it-possible-to-update-an-index-by-importing-an-updated-csv-file/292029/3 "2022-01-12T20:36:00Z")

</div>

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