# Delete documents

**URL:** <https://discuss.elastic.co/t/delete-documents/119745>\
**Category:** Elasticsearch\
**Created:** [February 14, 2018, 7:58am UTC](https://discuss.elastic.co/t/delete-documents/119745 "2018-02-14T07:58:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pororo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pororo/32/27711_2.png) [@Pororo](https://discuss.elastic.co/u/Pororo)\
**Post date:** [February 14, 2018, 7:58am UTC](https://discuss.elastic.co/t/delete-documents/119745/1 "2018-02-14T07:58:14Z")

</div>

Hi, I am kinda confused about the operation of deleting in ES.

If I import a json file which contains several items to ES thru logstash, also specify the index as "sampledata". Later on, I wanted to delete what I imported in ES. So I just did "delete /sampledata", the whole index was removed. But when I imported another file that has the same index as "sampledata", the old documents showed up when I search all the items in that index. So now, the index contains all new and old data which is supposed to be removed from ES.

All I want to do is to actually remove what I import.

---

<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:** [February 14, 2018, 8:01am UTC](https://discuss.elastic.co/t/delete-documents/119745/2 "2018-02-14T08:01:21Z")

</div>

If the index was removed and the documents are showing up, it'll be because they are being reimported.

---

<div class="post-metadata">

**Author:** ![Pororo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pororo/32/27711_2.png) [@Pororo](https://discuss.elastic.co/u/Pororo)\
**Post date:** [February 15, 2018, 3:55am UTC](https://discuss.elastic.co/t/delete-documents/119745/3 "2018-02-15T03:55:33Z")

</div>

Let's say I imported one json file called "test\_data.json" that only contained one item {"name" : "David", "age" : 12}. And then I removed the whole index in ES for that item. Later on, I cleared the same json file and put one new item {"Alice" : 10} on it and imported it to ES(same index as before). Then "David" still showed up in the index.

---

<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:** [February 15, 2018, 4:47am UTC](https://discuss.elastic.co/t/delete-documents/119745/4 "2018-02-15T04:47:30Z")

</div>

It might help if you post the code that you are using for this, including sample documents.

---

<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:** [March 15, 2018, 4:47am UTC](https://discuss.elastic.co/t/delete-documents/119745/5 "2018-03-15T04:47:42Z")

</div>

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