# Delete and Re-Create Index with ES output plugin

**URL:** <https://discuss.elastic.co/t/delete-and-re-create-index-with-es-output-plugin/193359>\
**Category:** Logstash\
**Created:** [August 1, 2019, 3:19pm UTC](https://discuss.elastic.co/t/delete-and-re-create-index-with-es-output-plugin/193359 "2019-08-01T15:19:43Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rkhapre](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rkhapre/32/48333_2.png) [@rkhapre](https://discuss.elastic.co/u/rkhapre)\
**Post date:** [August 1, 2019, 3:19pm UTC](https://discuss.elastic.co/t/delete-and-re-create-index-with-es-output-plugin/193359/1 "2019-08-01T15:19:43Z")

</div>

Hi All

I have a situation where my source dataset refreshes everyday, so there is need to first drop/delete the index manually using curl command and run the LS to create the index again.

Is there any option where we can drop the index and create the index using ES output plugin

Thanks

---

<div class="post-metadata">

**Author:** ![ylasri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ylasri/32/86120_2.png) [@ylasri](https://discuss.elastic.co/u/ylasri)\
**Post date:** [August 1, 2019, 3:22pm UTC](https://discuss.elastic.co/t/delete-and-re-create-index-with-es-output-plugin/193359/2 "2019-08-01T15:22:37Z")

</div>

Just make sure you provide a unique id for every document

---

<div class="post-metadata">

**Author:** ![rkhapre](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rkhapre/32/48333_2.png) [@rkhapre](https://discuss.elastic.co/u/rkhapre)\
**Post date:** [August 1, 2019, 3:25pm UTC](https://discuss.elastic.co/t/delete-and-re-create-index-with-es-output-plugin/193359/3 "2019-08-01T15:25:32Z")

</div>

I have a unique Ids in all the documents, but it is of no use as the whole document refresh or new document comes up everyday and the old ones are uselss. So i have to delete and recreate the index. I need to automate this through LS

This is typical case in ETL tool and we call this case as "truncate and load"

Important part here is index name should be same, as this will impact other programs downstream

---

<div class="post-metadata">

**Author:** ![ylasri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ylasri/32/86120_2.png) [@ylasri](https://discuss.elastic.co/u/ylasri)\
**Post date:** [August 1, 2019, 3:27pm UTC](https://discuss.elastic.co/t/delete-and-re-create-index-with-es-output-plugin/193359/4 "2019-08-01T15:27:53Z")

</div>

The best solution is to use a unique id based on attributes that doesn't changes, and output will update the whole document  
Otherwise you need to use curator or ILM  
May be if you provide more details son your use case we can better help

---

<div class="post-metadata">

**Author:** ![rkhapre](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rkhapre/32/48333_2.png) [@rkhapre](https://discuss.elastic.co/u/rkhapre)\
**Post date:** [August 1, 2019, 3:29pm UTC](https://discuss.elastic.co/t/delete-and-re-create-index-with-es-output-plugin/193359/5 "2019-08-01T15:29:18Z")

</div>

> [@rkhapre](#):
>
> but it is of no use as the whole document refresh or new document comes up everyday and the old ones are uselss. So i have to delete and recreate the index. I need to automate this through LS
> 
> This is typical case in ETL tool and we call this case as "truncate and load"

Above statement is important , this is the use case

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [August 1, 2019, 4:15pm UTC](https://discuss.elastic.co/t/delete-and-re-create-index-with-es-output-plugin/193359/6 "2019-08-01T16:15:21Z")

</div>

Logstash does not support that. It is designed to primarily handle never ending streams of data, not batches with defined start and end actions.

---

<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 29, 2019, 4:15pm UTC](https://discuss.elastic.co/t/delete-and-re-create-index-with-es-output-plugin/193359/7 "2019-08-29T16:15:24Z")

</div>

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