How to apply ilm policy to index patter tenat-*

Hello Expert,

I have to apply an ilm policy to my index patter so that the space full issue should not occur. Im able to create the policy but not able to apply to index patter as i need to add manually for index pattern timestamp created.

How i will be able to apply this to all index pattern which we have created. Im using kiban version 7.14.1.

Mahesh,
you have not understand ILM properly.
you can't apply a ilm to index pattern.

first you have to create ILM, create template and create alias. It is three step process.

for example
first create ILM

PUT _ilm/policy/myilm
{
  "policy": {
    "phases": {
      "hot": {
        "min_age": "0ms",
        "actions": {
          "rollover": {
            "max_primary_shard_size": "25gb",
            "max_age": "365d"
          }
        }
      }
    }
  }
}

then create template, what it says that your pattern is myindex-*,
when it rolls over it uses myindex--000000 and increament that number
and you now write to only myindex ( not with date or anything)

PUT _index_template/myindex_template
{
  "index_patterns": ["myindex-*"],
  "template": {
    "settings": {
      "index": {
        "lifecycle": {
          "name": "myindex",
          "rollover_alias": "myindex"
        },
        "number_of_shards": "1",
        "number_of_replicas": "1"
      }
    },
    "mappings": {}
  }
}

and finally you create blank index with date-number etc...
this will create index "myindex--000001"

PUT %3Cmyindex-%7Bnow%2Fd%7D-000001%3E
{
  "aliases": {
    "myindex": {
      "is_write_index": true
    }
  }
}

once all done. send data to "myindex" and it will write in to myindex--0000001
once it reaches 25 gig it will automatically create new index called "myindex--0000002"

Thank you Sachin.

We have change the ilm policy to delete file older than 7 days.

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