Create ILM Rollover on existing index

Hi,

I have an existing index that grows too big and I see perf going down (the index is 85Gb for the moment).

I created an IL policy, and now trying to create an index template to apply the policy on.

Given the existing index called mydocs, my index template settings look like that:

{
  "settings": {
    "index": {
      "lifecycle": {
        "name": "mydocs-index-rollover-policy",
        "rollover_alias": "mydocs"
      },
      "number_of_shards": "1",
      "number_of_replicas": "1"
    }
  },
  "aliases": {
      "mydocs": {
          "is_write_index": true
      }
  },
  "mappings": {}
}

However I get the following error:

"Invalid alias name [mydocs], an index exists with the same name as the alias"

What would be the correct approach to create this rollover?

Howdy @Baygon,

It sounds like if you did a Cat Indices you would find an index named "mydocs" which is why the system's preventing you from creating an alias of the same name. (You can check current alias names via Cat Aliases).

Your index aliases should be uniquely named from index names. Indices with rollover will format example INDEX_NAME-000001 (note the suffixing digit format) with INDEX_ALIAS. Here's an example walk through from our blog.

Thanks for your response.

Sure I can make the rollover alias unique, however how does it know that for start it should use the mydocs index (which already contains 85Gb of data)?

Or is it not possible to create rollover on an already existing index?

Manage existing indices | Elasticsearch Guide [7.14] | Elastic is the best place to start for managing existing indices with ILM.

1 Like

Got it, you basically need to do a reindex into a new one.
So I guess I'll also need to change the index name that my queries are pinging, thanks.

You shouldn't need to do that, no.

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