# Reindex - different doc count in the new index

**URL:** <https://discuss.elastic.co/t/reindex-different-doc-count-in-the-new-index/135685>\
**Category:** Elasticsearch\
**Created:** [June 13, 2018, 10:33am UTC](https://discuss.elastic.co/t/reindex-different-doc-count-in-the-new-index/135685 "2018-06-13T10:33:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kjetilhp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kjetilhp/32/30464_2.png) [@kjetilhp](https://discuss.elastic.co/u/kjetilhp)\
**Post date:** [June 13, 2018, 10:33am UTC](https://discuss.elastic.co/t/reindex-different-doc-count-in-the-new-index/135685/1 "2018-06-13T10:33:53Z")

</div>

I'm trying to reindex a timebased index to apply a new template but after reindexing the doc count of the new indexes are much less than original, I'm using the task api so I might miss some errors, not sure, can't find info on how to get errors after task i complete.

here is what I do:

first reindex:  
POST \_reindex?wait\_for\_completion=false  
{  
"source": {  
"index": "someindex-2018.05.25"  
},  
"dest": {  
"index": "someindex"  
},  
"script": {  
"lang": "painless",  
"source": "ctx.\_index = 'someindex-' + (ctx.\_index.substring('someindex-'.length(), ctx.\_index.length())) + '-2'"  
}  
}

after task is finished:

GET someindex-2018.05.25-1/\_count -\> 171026

GET someindex-2018.05.25/\_count -\> 930835

trying a second time...

GET someindex-2018.05.25-2/\_count . -\> 79994

and a third time, same doc count as the second one. No errors in the logs.

What am I doing wrong here?

br,  
Kjetil

---

<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 11, 2018, 10:43am UTC](https://discuss.elastic.co/t/reindex-different-doc-count-in-the-new-index/135685/2 "2018-07-11T10:43:49Z")

</div>

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