# Index, delete, index results in missing document?

**URL:** <https://discuss.elastic.co/t/index-delete-index-results-in-missing-document/8705>\
**Category:** Elasticsearch\
**Created:** [August 10, 2012, 3:23pm UTC](https://discuss.elastic.co/t/index-delete-index-results-in-missing-document/8705 "2012-08-10T15:23:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Snell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michael_snell/32/2770_2.png) [@Michael\_Snell](https://discuss.elastic.co/u/Michael_Snell)\
**Post date:** [August 10, 2012, 3:23pm UTC](https://discuss.elastic.co/t/index-delete-index-results-in-missing-document/8705/1 "2012-08-10T15:23:06Z")

</div>

Hi - We have an odd problem in ElasticSearch 0.19.8. We are using external  
versioning, but under some circumstances we know things have got out of  
sync. When this happens, we are deleting the document(s) in question, and  
then immediately reindex them (if we didn't do the delete, we'd get a  
version conflict exception when indexing).

However, when searching we find these documents are then missing - it's as  
if the delete has somehow silently prevented the index from working? Is  
this a known issue?

---

<div class="post-metadata">

**Author:** ![Michael\_Snell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michael_snell/32/2770_2.png) [@Michael\_Snell](https://discuss.elastic.co/u/Michael_Snell)\
**Post date:** [August 10, 2012, 3:42pm UTC](https://discuss.elastic.co/t/index-delete-index-results-in-missing-document/8705/2 "2012-08-10T15:42:07Z")

</div>

We've discovered that if we add a sleep of more than 60 seconds between the  
delete and the second index, then the document is correctly indexed, so it  
appears that delete is continuing to do something asynchronous after our  
call returns. Is there any way to make the call full synchronous? Or a  
better way of forcing a document to index when we know there will be a  
version conflict?

On Friday, 10 August 2012 16:23:06 UTC+1, Michael Snell wrote:

> Hi - We have an odd problem in Elasticsearch 0.19.8. We are using external  
> versioning, but under some circumstances we know things have got out of  
> sync. When this happens, we are deleting the document(s) in question, and  
> then immediately reindex them (if we didn't do the delete, we'd get a  
> version conflict exception when indexing).
> 
> However, when searching we find these documents are then missing - it's as  
> if the delete has somehow silently prevented the index from working? Is  
> this a known issue?

---

<div class="post-metadata">

**Author:** ![Michael\_Snell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michael_snell/32/2770_2.png) [@Michael\_Snell](https://discuss.elastic.co/u/Michael_Snell)\
**Post date:** [August 13, 2012, 11:32am UTC](https://discuss.elastic.co/t/index-delete-index-results-in-missing-document/8705/3 "2012-08-13T11:32:08Z")

</div>

Hi - I've now opened a bug/feature request that has better info: [index.gc\_deletes=0s does not behave as expected · Issue #2166 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/2166)

On Friday, 10 August 2012 16:42:07 UTC+1, Michael Snell wrote:

> We've discovered that if we add a sleep of more than 60 seconds between the delete and the second index, then the document is correctly indexed, so it appears that delete is continuing to do something asynchronous after our call returns. Is there any way to make the call full synchronous? Or a better way of forcing a document to index when we know there will be a version conflict?
> 
> On Friday, 10 August 2012 16:23:06 UTC+1, Michael Snell wrote:Hi - We have an odd problem in Elasticsearch 0.19.8. We are using external versioning, but under some circumstances we know things have got out of sync. When this happens, we are deleting the document(s) in question, and then immediately reindex them (if we didn't do the delete, we'd get a version conflict exception when indexing).
> 
> However, when searching we find these documents are then missing - it's as if the delete has somehow silently prevented the index from working? Is this a known issue?

--

---

<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, 3:16am UTC](https://discuss.elastic.co/t/index-delete-index-results-in-missing-document/8705/4 "2017-07-06T03:16:34Z")

</div>


