# Version mismatch while deleting the doc

**URL:** <https://discuss.elastic.co/t/version-mismatch-while-deleting-the-doc/14970>\
**Category:** Elasticsearch\
**Created:** [December 20, 2013, 8:37am UTC](https://discuss.elastic.co/t/version-mismatch-while-deleting-the-doc/14970 "2013-12-20T08:37:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arjit\_Gupta](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@Arjit\_Gupta](https://discuss.elastic.co/u/Arjit_Gupta)\
**Post date:** [December 20, 2013, 8:37am UTC](https://discuss.elastic.co/t/version-mismatch-while-deleting-the-doc/14970/1 "2013-12-20T08:37:19Z")

</div>

Hi,

I observed a version mis match when I run a deleteByQuery and when do a  
bulk delete by Id.

So If I have a doc I want to search and delete it I have two option either  
use

1. deleteByQuery
2. Search the document and issue a bulk delete

these both delete the documents ----  
But when I index the document with same Id which was deleted  
deleteByQuery starts the indexing with version 1  
where other (Search the document and issue a bulk delete) starts the  
indexing with lastVersion+1.

Is this expected ? I am working on version 0.90.1

If I am not clear let me know.

Thanks,  
Arjit

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/28c9c248-25b9-4773-a6a8-878bd595c565%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/28c9c248-25b9-4773-a6a8-878bd595c565%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 20, 2013, 9:33am UTC](https://discuss.elastic.co/t/version-mismatch-while-deleting-the-doc/14970/2 "2013-12-20T09:33:56Z")

</div>

Note that after 60s by default, whatever the method you used, version number will restart from 1.  
Are you sure you did not hit this?  
Is it something you can reproduce with a script?

Note that you can control this period using settings.gc\_deletes at index level.

See [https://gist.github.com/dadoonet/7704908](https://gist.github.com/dadoonet/7704908)

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 20 décembre 2013 at 09:37:23, Arjit Gupta ([arjit292@gmail.com](mailto:arjit292@gmail.com)) a écrit:

Hi,

I observed a version mis match when I run a deleteByQuery and when do a bulk delete by Id.

So If I have a doc I want to search and delete it I have two option either use

1. deleteByQuery
2. Search the document and issue a bulk delete

these both delete the documents ----  
But when I index the document with same Id which was deleted  
deleteByQuery starts the indexing with version 1  
where other (Search the document and issue a bulk delete) starts the indexing with lastVersion+1.

Is this expected ? I am working on version 0.90.1

If I am not clear let me know.

## Thanks, Arjit

You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/28c9c248-25b9-4773-a6a8-878bd595c565%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/28c9c248-25b9-4773-a6a8-878bd595c565%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/etPan.52b40f04.1d4ed43b.111%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.52b40f04.1d4ed43b.111%40MacBook-Air-de-David.local).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:00am UTC](https://discuss.elastic.co/t/version-mismatch-while-deleting-the-doc/14970/3 "2017-07-06T02:00:02Z")

</div>


