# Delete all documents from index before indexing new set

**URL:** <https://discuss.elastic.co/t/delete-all-documents-from-index-before-indexing-new-set/59735>\
**Category:** Logstash\
**Created:** [September 3, 2016, 7:41pm UTC](https://discuss.elastic.co/t/delete-all-documents-from-index-before-indexing-new-set/59735 "2016-09-03T19:41:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sivabalan19](https://avatars.discourse-cdn.com/v4/letter/s/3e96dc/32.png) [@sivabalan19](https://discuss.elastic.co/u/sivabalan19)\
**Post date:** [September 3, 2016, 7:41pm UTC](https://discuss.elastic.co/t/delete-all-documents-from-index-before-indexing-new-set/59735/1 "2016-09-03T19:41:22Z")

</div>

Hi,

My jdbc input plugin is getting all the new documents which needs to be indexed. I do have a requirement to delete all the documents before indexing the new set. Please suggest me how i can delete my old documents which are already there.

Should i use http output plugin before by elasticsearch ? I see delete-by-query suites me.  
how can we set the data (query) to the HTTP url in my logstash configuration?

-Thanks

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [September 3, 2016, 8:55pm UTC](https://discuss.elastic.co/t/delete-all-documents-from-index-before-indexing-new-set/59735/2 "2016-09-03T20:55:01Z")

</div>

It's more efficient to delete the index and create another.

---

<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:** [July 6, 2017, 4:40am UTC](https://discuss.elastic.co/t/delete-all-documents-from-index-before-indexing-new-set/59735/3 "2017-07-06T04:40:02Z")

</div>


