# Deletions in reindex

**URL:** <https://discuss.elastic.co/t/deletions-in-reindex/299650>\
**Category:** Elasticsearch\
**Tags:** reindex\
**Created:** [March 14, 2022, 4:50pm UTC](https://discuss.elastic.co/t/deletions-in-reindex/299650 "2022-03-14T16:50:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aditya\_Verma1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aditya_verma1/32/100682_2.png) [@Aditya\_Verma1](https://discuss.elastic.co/u/Aditya_Verma1)\
**Post date:** [March 14, 2022, 4:50pm UTC](https://discuss.elastic.co/t/deletions-in-reindex/299650/1 "2022-03-14T16:50:32Z")

</div>

I have an index which i want to reindex to a new index increasing the no of primary shards. So i started reindexing. I didn't make the source index read only so ingestions, updations and deletions were happening on the source index. Now when i am trying to sync the changes from old index to new index by starting reindexing again with version\_type set to external. All the changes updations and ingestions have been done. But deletions in old index were not done in the new index. How to handle this?

---

<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:** [March 14, 2022, 4:55pm UTC](https://discuss.elastic.co/t/deletions-in-reindex/299650/2 "2022-03-14T16:55:27Z")

</div>

Well. The reindex reads existing documents. Not deleted (so theorically not existing) documents.  
I don't think of any magical idea to handle that.

If it's a one time operation, I'd probably try to compare all ids from the new index with the old one.  
It's a heavy task, so you can may be find a smart way for this.  
Like if you have a timestamp in your documents, count the number of docs per day (date\_hsitogram agg) and for any day where the number of docs is different, compare each id from the destination with the source.  
It should be easy as a:

```auto
HEAD index/_doc/id

```

404 if the document is not found.  
2xx otherwise.

---

<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:** [April 11, 2022, 4:55pm UTC](https://discuss.elastic.co/t/deletions-in-reindex/299650/3 "2022-04-11T16:55:28Z")

</div>

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