illegal_argument_exception: index.lifecycle.rollover_alias [alias-efk-stack] does not point to index [efk-stack-pod-name]

73 views Asked by At

Need help for setting up ilm policy for existing indices. I have created first the index Lifecycle Policy which will delete data older than 10 days with name "10-days-archival-policy". Then created an index template which matches index patterns as shown below :

PUT _index_template/efk_template
{
  "template": {
    "settings": {
      "index": {
        "lifecycle": {
          "name": "10-days-archival-policy",
          "rollover_alias": "efk-stack"
        },
        "number_of_shards": "1",
        "number_of_replicas": "1"
      }
    }
  },
  "index_patterns": [
    "efk-stack-*"
  ],
  "composed_of": []
}

But still error occurred :
illegal_argument_exception: index.lifecycle.rollover_alias [alias-efk-stack] does not point to index [efk-stack-podname-2024.01.01]

1

There are 1 answers

0
Farhad Kazemi On

I think you should edit your index with an api call like below so that your index (which is a part of that index-pattern) gets the related alias, also if its the current index that data is getting written on it be sure to set is_write_index option to true

curl --header 'Content-Type: application/json' \
   -u $user --location --request PUT "${url}/efk-stack-podname-2024.01.01" --data-raw "{
   \"aliases\": {\"alias-efk-stack\": {\"is_write_index\": true}}
   }"