# Some question about soft\_deletes and Reindex API

**URL:** https://discuss.elastic.co/t/some-question-about-soft-deletes-and-reindex-api/302765
**Category:** Elasticsearch
**Created:** [April 20, 2022, 4:24am UTC](https://discuss.elastic.co/t/some-question-about-soft-deletes-and-reindex-api/302765 "2022-04-20T04:24:44Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![zhangzongdong](https://avatars.discourse-cdn.com/v4/letter/z/858c86/32.png) [@zhangzongdong](https://discuss.elastic.co/u/zhangzongdong)
#### Post date: [April 20, 2022, 4:24am UTC](https://discuss.elastic.co/t/some-question-about-soft-deletes-and-reindex-api/302765/1 "2022-04-20T04:24:44Z")

</div>

## Two questions

1. How to use reindex API with zero downtime.
2. Could the index setting of `index.soft_deletes_enabled` be non-dynamic and replace reindex API with setting `index.soft_deletes_enabled` to true for a exist index witch needs `soft_deletes` enabled.

## where are Questions from

- when i read the document of Elasticsearch, there is a word come up with me that "Soft deletes can only be configured at index creation, if you want to enabled it for a exist index, you must reindex your data into a new index with soft deletes enabled".

- I have read some paper of Lucene about the feature of `soft deletes`. And I have do some test with Lucene that it work well when using hard delete and soft delete in the mean time. So I think hard delete is not conflicted with soft delete in Lucene.

- In the Elasticsearch level, `index.soft_deletes_enabled` is a `IndexScope.Final` setting. And I ask one of authors of Elasticsearch, he tells me that the reason why made it final is in order to siplify model.

- So I do some test with Elasticsearch in v6.8.3, download the souce code and modify setting of `index.soft_deletes.enabled` as non-dynamic which look like following:

```auto
Setting.boolSetting("index.soft_deletes.enabled", false, Property.IndexScope);

```

- It work well for me that enabled `index.soft_deletes.enabled` for a exist closed index. When I reopen the index, it still work well in CURD and so on.

- As we know, the reindex API is just reindex snapshot of exist index when it triggers. It will result in inconsistent data between old and new index when reindex then updating data in the old index. So here comes with the first question, is there a best practice to use reindex API with zero downtime.

- if not, why not for non-dynamic setting of `index.soft_deletes.enabled` to avoid reindex in this situation. Here comes with the second question I mentions forward.

- Could anyone explain the two questions in principle. Thanks very much.

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [April 20, 2022, 8:13am UTC](https://discuss.elastic.co/t/some-question-about-soft-deletes-and-reindex-api/302765/2 "2022-04-20T08:13:28Z")

</div>

Hey,

I think there is a misunderstanding of soft deletes. Can you explain why and how you link soft deletes and using reindex API?

And also how you link reindex API and zero downtime?

Adding some more context about your goal would help a lot to figure out what you are after (independent from any technology or settings), so that we can maybe go from there.

Side note: Since 7.6.0 the soft deletes setting is deprecated, see [Index modules | Elasticsearch Guide [8.1] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/8.1/index-modules.html)

---

<div class="post-metadata">

### Author: ![zhangzongdong](https://avatars.discourse-cdn.com/v4/letter/z/858c86/32.png) [@zhangzongdong](https://discuss.elastic.co/u/zhangzongdong)
#### Post date: [April 21, 2022, 6:44am UTC](https://discuss.elastic.co/t/some-question-about-soft-deletes-and-reindex-api/302765/3 "2022-04-21T06:44:29Z")

</div>

- My data is now running in the v6.8.3 version of Elasticsearch in the product environment.

- I am doing research of CCR for high availability in product, and found that it should do reindex to have soft\_deletes enabled, so that the index can be applied CCR feature.

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [April 21, 2022, 9:12am UTC](https://discuss.elastic.co/t/some-question-about-soft-deletes-and-reindex-api/302765/4 "2022-04-21T09:12:15Z")

</div>

How does reindex come into play of your research as per your question above? CCR and reindex are very different beasts.

---

<div class="post-metadata">

### Author: ![zhangzongdong](https://avatars.discourse-cdn.com/v4/letter/z/858c86/32.png) [@zhangzongdong](https://discuss.elastic.co/u/zhangzongdong)
#### Post date: [April 22, 2022, 2:01am UTC](https://discuss.elastic.co/t/some-question-about-soft-deletes-and-reindex-api/302765/5 "2022-04-22T02:01:00Z")

</div>

- In order to applied CCR feature with a exist index whose setting of `soft_deletes` is disabled, it should use reindex API to enabled settting of `soft_deletes` for the target index. see [ccr-leader-requirements](https://www.elastic.co/guide/en/elasticsearch/reference/current/xpack-ccr.html#ccr-leader-requirements)

- As i know, the reindex API is just reindex snapshot of exist index when it triggers. So if the data continue change when reindex triggers, the data will disconsistent when reindex done. The only way i think out is to down the target index then using reindex. So i want to ask if I misunderstand the reindex API. Is there a way to use reindex without downtime

- As i know, if only using reindex API, it can't. So why not take `soft_deletes` as non-dynamic setting. As result, i change the `Scope.Final` of `soft_enabled` and it work well. But i don't know if there is something wrong i not find for what i do.

- if change scope of `soft_deletes` as non-dynamic, it could be more convinient to use CCR.

- You konw, Since 7.6, the soft deletes setting is deprecated, but it can't scale how many people using Elasticsearch whose version is prior to 7.6 and before 7.x, the default of `soft_deletes` is disabled. I suppose the most popular version is between 6.5 and 7.5

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [April 26, 2022, 1:12am UTC](https://discuss.elastic.co/t/some-question-about-soft-deletes-and-reindex-api/302765/6 "2022-04-26T01:12:31Z")

</div>

> [@zhangzongdong](#):
>
> - My data is now running in the v6.8.3 version of Elasticsearch in the product environment.

Just a short note to mention that 6.X is [EOL](https://www.elastic.co/support/eol), please upgrade 🙂

---

<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 24, 2022, 1:12am UTC](https://discuss.elastic.co/t/some-question-about-soft-deletes-and-reindex-api/302765/7 "2022-05-24T01:12:58Z")

</div>

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