# Why data is inserting in index in delete phase, why not new index ... are we missing any configuration?

**URL:** https://discuss.elastic.co/t/why-data-is-inserting-in-index-in-delete-phase-why-not-new-index-are-we-missing-any-configuration/350054
**Category:** Elasticsearch
**Tags:** ilm-index-lifecycle-management, rollups
**Created:** [December 28, 2023, 8:12am UTC](https://discuss.elastic.co/t/why-data-is-inserting-in-index-in-delete-phase-why-not-new-index-are-we-missing-any-configuration/350054 "2023-12-28T08:12:07Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Shahzaib\_Khan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shahzaib_khan/32/123224_2.png) [@Shahzaib\_Khan](https://discuss.elastic.co/u/Shahzaib_Khan)
#### Post date: [December 28, 2023, 8:12am UTC](https://discuss.elastic.co/t/why-data-is-inserting-in-index-in-delete-phase-why-not-new-index-are-we-missing-any-configuration/350054/1 "2023-12-28T08:12:07Z")

</div>

I am facing an issue with Elasticsearch where, even after the rollover phase is successfully completed and a new index is created, data continues to be inserted into the old rollover index instead of the newly created index even though the old rollover index ilm policy transitioned to delete face. The rollover process seems to be working as expected, but the new index is not being recognized for indexing operations.

**Environment:**

Elasticsearch Version: v 7.17

ilm policy:

```json
PUT _ilm/policy/demo-rollover_policy
{
  "policy": {
    "phases": {
      "hot": {                                
        "actions": {
          "rollover": {
            "max_size": "50kb" 
          }
        }
      },
      "delete": {
        "min_age": "5m",                     
        "actions": {
          "delete": {}                      
        }
      }
    }
  }
}

```

Index\_template\_preview:

```json
{
  "template": {
    "settings": {
      "index": {
        "lifecycle": {
          "name": "demo-rollover_policy",
          "rollover_alias": "demo"
        }
      }
    },
    "aliases": {},
    "mappings": {}
  }
}

```

**Reproduction Steps:**

Create an index with the specified ILM policy and index template.  
Monitor the rollover process and ensure that the new index is created.  
Attempt to insert data into the rollover index.

**Expected Behavior:**  
Data should be inserted into the newly created index after the rollover when posted data into the old rollover index

**Actual Behavior:**  
Data is still being inserted into the old rollover index, however the the rollover index is transitioned to delete phase.

What I have read in the documentation is that on a successful rollover, ES will automatically create the new index according to the template, switch the write index to the new one and change the phase of the old index based on our lifecycle policy.

**My understanding to this process is after the successful rollover, when we post data to the old index that is rolled over, it will be inserted into the new index that is created. Is there any configuration that i am missing and causing this behavior.**

**Note:**  
This issue is impacting our data indexing workflow, and we would appreciate any guidance or assistance in resolving this behavior.

Thank you for your attention to this matter.

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [December 28, 2023, 9:13am UTC](https://discuss.elastic.co/t/why-data-is-inserting-in-index-in-delete-phase-why-not-new-index-are-we-missing-any-configuration/350054/2 "2023-12-28T09:13:25Z")

</div>

Please provide all the steps you have taken to create the indices and roll them over. That way we can spot any issues and possibly also recreaste the issue.

---

<div class="post-metadata">

### Author: ![Shahzaib\_Khan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shahzaib_khan/32/123224_2.png) [@Shahzaib\_Khan](https://discuss.elastic.co/u/Shahzaib_Khan)
#### Post date: [January 1, 2024, 5:59am UTC](https://discuss.elastic.co/t/why-data-is-inserting-in-index-in-delete-phase-why-not-new-index-are-we-missing-any-configuration/350054/3 "2024-01-01T05:59:52Z")

</div>

1. Created a rollover policy using the above request body in demo-rollover-policy.
2. Then, I created an index template using the above request body in index\_template\_preview.
3. Afterward, I created an index named "demo-0000," assigned an alias "demo" to it, and set "is\_write\_index" to true.

After implementing all the above steps, the rollover policy was successfully assigned to the index named "demo-00001." It successfully rollovers and creates a new index named "demo-00002" with the same alias "demo." After the creation of the new index, the previous index "demo-00001" entered the delete phase. However, when attempting to insert data with the index name "demo-00001," the new data is still being posted to the old index "demo-00001," which should not be the case. The rollover process should have shifted the write\_index to "demo-00002."

I don't have any snapshots available right now; otherwise, I would have provided them earlier. I hope this clarifies the scenario through my explanation.

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [January 1, 2024, 7:06am UTC](https://discuss.elastic.co/t/why-data-is-inserting-in-index-in-delete-phase-why-not-new-index-are-we-missing-any-configuration/350054/4 "2024-01-01T07:06:07Z")

</div>

> [@Shahzaib\_Khan](#):
>
> After the creation of the new index, the previous index "demo-00001" entered the delete phase. However, when attempting to insert data with the index name "demo-00001," the new data is still being posted to the old index "demo-00001,"

You should be posting data to the alias `demo` not the concrete index `demo-00001` That is the point of the write alias, clients write to be the write alias which points to the correct/ new concrete index

---

<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: [January 29, 2024, 7:06am UTC](https://discuss.elastic.co/t/why-data-is-inserting-in-index-in-delete-phase-why-not-new-index-are-we-missing-any-configuration/350054/5 "2024-01-29T07:06:39Z")

</div>

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