# Expunge deleted documents / reindex to same index name

**URL:** <https://discuss.elastic.co/t/expunge-deleted-documents-reindex-to-same-index-name/177027>\
**Category:** Elasticsearch\
**Created:** [April 16, 2019, 8:33am UTC](https://discuss.elastic.co/t/expunge-deleted-documents-reindex-to-same-index-name/177027 "2019-04-16T08:33:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AndreKR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrekr/32/6233_2.png) [@AndreKR](https://discuss.elastic.co/u/AndreKR)\
**Post date:** [April 16, 2019, 8:33am UTC](https://discuss.elastic.co/t/expunge-deleted-documents-reindex-to-same-index-name/177027/1 "2019-04-16T08:33:56Z")

</div>

I have a bunch of time-series indices (one per week) with a lot of deleted documents (because older data gets aggregated):

![image](https://us1.discourse-cdn.com/elastic/original/3X/b/3/b30338041c851ccf16a81320fdce26c91a6615da.png)

According to [this](https://discuss.elastic.co/t/advice-on-force-merge/100781) I should not force-merge them when I expect there to be writes (more aggregation) later.

Apparently the alternative is reindexing.

What is the most sensible strategy to do this regularly? Because there seems to be no way to rename indexes, I can only come up with somewhat convoluted solutions:

a) Have an alias (e.g. `histograms-2017-33`) for _every_ index. When initially creating the actual index, name it for example `histograms-2017-33-v1`. When reindexing, reindex to `histograms-2017-33-v2` and then point the alias to the new version.

b) Reindex to `histograms-2017-33-temp` and then delete `histograms-2017-33` and reindex _again_ back to `histograms-2017-33`.

c) Something entirely different?

---

<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:** [May 14, 2019, 8:33am UTC](https://discuss.elastic.co/t/expunge-deleted-documents-reindex-to-same-index-name/177027/2 "2019-05-14T08:33:58Z")

</div>

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