Applying a policy to an index template

This functionality is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.

The setting can be set in an index template so that it is automatically applied to indexes matching the templates index pattern:

PUT _template/my_template
  "index_patterns": ["test-*"], 
  "settings": {
    "number_of_shards": 1,
    "number_of_replicas": 1,
    "": "my_policy", 
    "index.lifecycle.rollover_alias": "test-alias"

This template will be applied to all indexes which have a name starting with test-

The template will set the policy to be used to my_policy

Now that a policy exists and is used in an index template we can create an initial index which will be managed by our policy:

PUT test-000001
  "aliases": {
      "is_write_index": true 

Set this initial index to be the write index for this alias.

We can now write data to the test-alias alias. Because we have a rollover action defined in our policy, when the index grows larger than 25GB index lifecycle management will create a new index and roll the alias over to use the new index automatically.