# ILM and alias error

**URL:** <https://discuss.elastic.co/t/ilm-and-alias-error/345230>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [October 17, 2023, 3:25pm UTC](https://discuss.elastic.co/t/ilm-and-alias-error/345230 "2023-10-17T15:25:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![grumo35](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/grumo35/32/59451_2.png) [@grumo35](https://discuss.elastic.co/u/grumo35)\
**Post date:** [October 17, 2023, 3:25pm UTC](https://discuss.elastic.co/t/ilm-and-alias-error/345230/1 "2023-10-17T15:25:38Z")

</div>

Hi,

i've followed the ILM setup guide and came accross this error  
"illegal\_argument\_exception: index.lifecycle.rollover\_alias [test-alias] does not point to index x"

> [@Index Lifecycle Management "does not point to index" error](https://discuss.elastic.co/t/index-lifecycle-management-does-not-point-to-index-error/211513/4):
>
> Lots of great questions. Let me try to give you some pointers. ILM is typically used in combination with rollovers. The rollover API causes new indexes to be created continuously. Initially, all of your data goes into an index called something like logs-000001. After that index reaches a certain age or a certain size, it "rolls over" to a new index logs-000002 and all new data will go to that new index. After a while, that index will rollover to a new index logs-000003 etc etc. Now, your appli…

Now i understand that you should create the index alias not in the index mapping but when the first index is created.

However i have 300+ indices that i would like to delete after a certain time, putting an ilm policy and delete phase seems to be the best idea for me.

But i'm unable to figure out why the alias need to point to data if the index is deleted ? and how to setup such alias if indicies already exists ? should i make a wildcard to all my policy related indicies ?

---

<div class="post-metadata">

**Author:** ![grumo35](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/grumo35/32/59451_2.png) [@grumo35](https://discuss.elastic.co/u/grumo35)\
**Post date:** [October 18, 2023, 1:55pm UTC](https://discuss.elastic.co/t/ilm-and-alias-error/345230/2 "2023-10-18T13:55:25Z")

</div>

Hi,

I've created the alias corresponding the the indicies of my ilm policy.

```auto
POST _aliases
{
  "actions": [
    {
      "add": {
        "index": "filebeat-*",
        "alias": "test-alias"
      }
    }
  ]
}

```

My ilm policy was applied with the following call :

```auto

PUT _index_template/filebeat_template
{
  "index_patterns": ["filebeat-*"],                 
  "template": {
    "settings": {
      "number_of_shards": 1,
      "number_of_replicas": 1,
      "index.lifecycle.name": "45-days-7-hot",      
      "index.lifecycle.rollover_alias": "test-alias"    
    }
  }
}

```

I still have this error

```auto
illegal_argument_exception: rollover target [test-alias] does not point to a write index

```

Followed this error i've created the write index pointing to my alias

```auto
PUT test-alias-01
{
  "aliases": {
    "test-alias": {
      "is_write_index": true
    }
  }
}

```

So what i dont understand is for my data to be deleted after 45 days why should i need to use the rollover mechanism and a DataStream ??

---

<div class="post-metadata">

**Author:** ![grumo35](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/grumo35/32/59451_2.png) [@grumo35](https://discuss.elastic.co/u/grumo35)\
**Post date:** [October 18, 2023, 2:37pm UTC](https://discuss.elastic.co/t/ilm-and-alias-error/345230/3 "2023-10-18T14:37:19Z")

</div>

After a while errors disapeared with the write index.

however, i still dont get why older indicies with the policy applied are not deleted 😅

```auto

GET filebeat-x-2023.08.02/_ilm/explain

{
  "indices" : {
    "filebeat-x-2023.08.02" : {
      "index" : "filebeat-x-2023.08.02",
      "managed" : true,
      "policy" : "45-days-7-hot",
      "lifecycle_date_millis" : 1690988844545,
      "age" : "76.97d",
      "phase" : "hot",
      "phase_time_millis" : 1697629327710,
      "action" : "rollover",
      "action_time_millis" : 1695740696478,
      "step" : "check-rollover-ready",
      "step_time_millis" : 1697637727579,
      "is_auto_retryable_error" : true,
      "failed_step_retry_count" : 1581,
      "phase_execution" : {
        "policy" : "45-days-7-hot",
        "phase_definition" : {
          "min_age" : "0ms",
          "actions" : {
            "rollover" : {
              "max_age" : "2d"
            }
          }
        },
        "version" : 5,
        "modified_date_in_millis" : 1697552390771
      }
    }
  }
}

```

The policy is delete after 45 days

---

<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:** [November 15, 2023, 2:37pm UTC](https://discuss.elastic.co/t/ilm-and-alias-error/345230/4 "2023-11-15T14:37:32Z")

</div>

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