Reindex - different doc count in the new index

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

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