# Reindex data will not copy all documents

**URL:** https://discuss.elastic.co/t/reindex-data-will-not-copy-all-documents/266967
**Category:** Elasticsearch
**Created:** [March 11, 2021, 3:42pm UTC](https://discuss.elastic.co/t/reindex-data-will-not-copy-all-documents/266967 "2021-03-11T15:42:02Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![dslavescu](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@dslavescu](https://discuss.elastic.co/u/dslavescu)
#### Post date: [March 11, 2021, 3:42pm UTC](https://discuss.elastic.co/t/reindex-data-will-not-copy-all-documents/266967/1 "2021-03-11T15:42:03Z")

</div>

Hello,

I am trying to migrate data from an ES cluster 5.5.6 to ES 7.6.2, using an intermediate cluster ES 6.8 in order to reindex the data and prepare the mapping for ES 7.6.2 version.  
I am using a python script to automate this migration(using the elasticsearch-py library), where i basically create a snapshot of the indices in my 5.5.6 cluster, recreate all indices and the corresponding settings and mapping in the intermediate 6.8 cluster, reindex the data, create another snapshot and restore it in the final 7.6.2 cluster.

My issue is that when i reindex the data in the intermediate 6.8 cluster, i don't get the same number of documents as the original index. I did not encounter any errors during the process, except the fact that sometimes the cluster will raise connection timeouts.  
Below you can find exactly the parameters of the reindex operation:

reindexed\_indices = esReindex.reindex({ "source": {"index": index['index']},"dest": {"index": index['index']+'\_new'}, "script": { "source": "\n ctx.\_source.type = ctx.\_type;\n ctx.\_id = ctx.\_type + "-" + ctx.\_id;\n ctx.\_type = "\_doc";\n " }}, wait\_for\_completion=True, slices=20)

Also tried to rerun the reindex by using the op\_type: create option:

reindexed\_indices = esReindex.reindex({"conflicts":"proceed", "source": {"index": index['index']},"dest": {"index": index['index']+'\_new', "op\_type":"create"}, "script": { "source": "\n ctx.\_source.type = ctx.\_type;\n ctx.\_id = ctx.\_type + "-" + ctx.\_id;\n ctx.\_type = "\_doc";\n " }}, wait\_for\_completion=True, slices=20)

Did anyone encounter a similar issue and managed to fix it?

Thanks,  
Diana

---

<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 8, 2021, 3:42pm UTC](https://discuss.elastic.co/t/reindex-data-will-not-copy-all-documents/266967/2 "2021-04-08T15:42:34Z")

</div>

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