Ilm policy for existing index

Hi Team,

I am trying to understand how does ilm policy also setup new indices.

I understand that one needs to first setup the ilm policy which is then assigned to a template e.g

{
  "index_patterns": ["test-*"], 
  "template": {
    "settings": {
      "number_of_shards": 1,
      "number_of_replicas": 1,
      "index.lifecycle.name": "my_ilm_policy", 
      "index.lifecycle.rollover_alias": "my_ilm_policy" 
    }
  }
}

As you can observe that this has a lifecycle name and roll_over alias
If I now wanted to apply this policy to an existing index, which I have written like this

output {
  #stdout { codec => rubydebug { metadata => true }}
  elasticsearch {
    hosts => "${ELASTIC_HOST}"
    index => "test-"
    user => "${ELASTIC_USER}"
    password => "${ELASTIC_PWD}"
	document_type => "sqltest"
	document_id => "%{id}"
  }  
}

does that mean I am no longer required to provide index and just enable the ilm policy and it takes care of the index generation

elasticsearch {
        hosts => "${ELASTIC_HOST}"
        user => "${ELASTIC_USER}"
        password => "${ELASTIC_PWD}"
        document_id => "%{id}"
        ilm_enabled => true
        ilm_rollover_alias => "test_ilm"
        ilm_pattern => "000001"
        ilm_policy => "my_ilm_policy"
    }

And if yes.
Then what happens to my older indices, can I just reindex them

POST _reindex
{
  "source": {
    "index": "test-"
  },
  "dest": {
    "index": "test_ilm-000001"
  }
}

Sorry for the long post, I am getting confused how does ilm policy help in creating indices with patterns eg. idex-0001,index002 so that it knows when to send that index pattern to a delete stage
Does the new index patterns get generated when a new document has become part of the index ?

Thanks

Yep!

Also yep! Or just manually delete them after a period of time.

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