# Can't set up index lifecycle correctly

**URL:** <https://discuss.elastic.co/t/cant-set-up-index-lifecycle-correctly/313768>\
**Category:** Kibana\
**Tags:** ilm-index-lifecycle-management\
**Created:** [September 6, 2022, 8:47am UTC](https://discuss.elastic.co/t/cant-set-up-index-lifecycle-correctly/313768 "2022-09-06T08:47:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fetchbak](https://avatars.discourse-cdn.com/v4/letter/f/e5b9ba/32.png) [@fetchbak](https://discuss.elastic.co/u/fetchbak)\
**Post date:** [September 6, 2022, 8:47am UTC](https://discuss.elastic.co/t/cant-set-up-index-lifecycle-correctly/313768/1 "2022-09-06T08:47:48Z")

</div>

Hi there!

I'm trying to set up the lifecycle of my indexes and I'm getting the following error:  
**"Index lifecycle error**  
**illegal\_argument\_exception: index.lifecycle.rollover\_alias [test-alias] does not point to index [test-2022.09.06]"**  
Here is my settings of logstash:

```auto
input {
  beats {
    port => 5044
  }
}

output {
        elasticsearch {
            user => "my_username"
            password => "my_password"
            ssl => true
            cacert => '/my_path_to_crt/my_crt.crt'
            hosts => ["https://localhost:9200"]
            index => "test-%{+YYYY.MM.dd}"
            }
}

```

Here is my policy:

```auto
PUT _ilm/policy/my_policy
{
  "policy": {
    "phases": {
      "hot": {
        "min_age": "0ms",
        "actions": {
          "set_priority": {
            "priority": 100
          },
          "rollover": {
            "max_primary_shard_size": "50gb",
            "max_age": "1m"
          }
        }
      },
      "delete": {
        "min_age": "2m",
        "actions": {
          "delete": {
            "delete_searchable_snapshot": true
          }
        }
      }
    }
  }
}

```

Here is my template:

```auto
{
  "template": {
    "settings": {
      "index": {
        "lifecycle": {
          "name": "my_policy",
          "rollover_alias": "test-alias"
        },
        "routing": {
          "allocation": {
            "include": {
              "_tier_preference": "data_content"
            }
          }
        },
        "number_of_shards": "1",
        "number_of_replicas": "1"
      }
    },
    "aliases": {},
    "mappings": {}
  }
}

```

All settings from the example which is here: [elastic\_docs](https://www.elastic.co/guide/en/elasticsearch/reference/current/set-up-lifecycle-policy.html#apply-policy-manually)  
I tried to configure through the Kibana interface and through Dev Tools, the result is the same. I get the same error (given above).  
Also create an initial managed index:

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

```

And this index works, it is rotated and deleted as described in the policy (hot phase 1 minute and older than 2 minutes are deleted). But it`s not green (health) it`s yellow and empty (Docs count 0).  
At the same time, my index, which comes from the logstash, is not rotated, the template "test-000001" is not applied to it, but it is not empty, it is also yellow, not green, and when it comes time to rotate it, it gives the error that is indicated at the beginning of the post.

 ![Index_Management](https://us1.discourse-cdn.com/elastic/original/3X/8/e/8e88889d7909fe0af7c6dbb1ee3a8912940f5620.png)

Read tons of docs but can't understand why it's not working correctly.  
Could someone tell me what I'm doing wrong?

---

<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:** [October 4, 2022, 8:48am UTC](https://discuss.elastic.co/t/cant-set-up-index-lifecycle-correctly/313768/2 "2022-10-04T08:48:23Z")

</div>

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