# When I index some documents and they are not refreshed yet, can I deleted them?

**URL:** https://discuss.elastic.co/t/when-i-index-some-documents-and-they-are-not-refreshed-yet-can-i-deleted-them/45085
**Category:** Elasticsearch
**Created:** [March 22, 2016, 9:48am UTC](https://discuss.elastic.co/t/when-i-index-some-documents-and-they-are-not-refreshed-yet-can-i-deleted-them/45085 "2016-03-22T09:48:13Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![makeyang](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@makeyang](https://discuss.elastic.co/u/makeyang)
#### Post date: [March 22, 2016, 9:48am UTC](https://discuss.elastic.co/t/when-i-index-some-documents-and-they-are-not-refreshed-yet-can-i-deleted-them/45085/1 "2016-03-22T09:48:13Z")

</div>

let's say I bulk insert some documents and then I want to delete them, can ES handle it properly? if so, how?

---

<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: [March 22, 2016, 10:03am UTC](https://discuss.elastic.co/t/when-i-index-some-documents-and-they-are-not-refreshed-yet-can-i-deleted-them/45085/2 "2016-03-22T10:03:01Z")

</div>

Yes it can.  
The easiest way to understand would be to read this chapter - [https://www.elastic.co/guide/en/elasticsearch/guide/master/inside-a-shard.html](https://www.elastic.co/guide/en/elasticsearch/guide/master/inside-a-shard.html)

---

<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: [March 22, 2016, 10:06am UTC](https://discuss.elastic.co/t/when-i-index-some-documents-and-they-are-not-refreshed-yet-can-i-deleted-them/45085/3 "2016-03-22T10:06:34Z")

</div>

If you have explicitly assigned IDs to the documents at the client prior to indexing them you can delete them using this before a refresh takes place and they are made searchable. If you however rely on Elasticsearch assigning the document IDs, you may need to wait until you can identify the documents through a query unless you are keeping track of the IDs being returned in the bulk request response.

---

<div class="post-metadata">

### Author: ![makeyang](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@makeyang](https://discuss.elastic.co/u/makeyang)
#### Post date: [March 22, 2016, 10:37am UTC](https://discuss.elastic.co/t/when-i-index-some-documents-and-they-are-not-refreshed-yet-can-i-deleted-them/45085/4 "2016-03-22T10:37:18Z")

</div>

so if I have id, I can delete it, if not, I can't. right?

---

<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: [March 22, 2016, 10:42am UTC](https://discuss.elastic.co/t/when-i-index-some-documents-and-they-are-not-refreshed-yet-can-i-deleted-them/45085/5 "2016-03-22T10:42:20Z")

</div>

I believe so but have not tested it. What is your use case?

---

<div class="post-metadata">

### Author: ![makeyang](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@makeyang](https://discuss.elastic.co/u/makeyang)
#### Post date: [March 22, 2016, 11:09am UTC](https://discuss.elastic.co/t/when-i-index-some-documents-and-they-are-not-refreshed-yet-can-i-deleted-them/45085/6 "2016-03-22T11:09:42Z")

</div>

no use case right now. I'll do some test later. thank u

---

<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 5, 2017, 11:06pm UTC](https://discuss.elastic.co/t/when-i-index-some-documents-and-they-are-not-refreshed-yet-can-i-deleted-them/45085/7 "2017-07-05T23:06:19Z")

</div>


