# How to setup ILM in elastic search

**URL:** <https://discuss.elastic.co/t/how-to-setup-ilm-in-elastic-search/222876>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [March 10, 2020, 7:24am UTC](https://discuss.elastic.co/t/how-to-setup-ilm-in-elastic-search/222876 "2020-03-10T07:24:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rahulkothanath](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahulkothanath/32/99122_2.png) [@rahulkothanath](https://discuss.elastic.co/u/rahulkothanath)\
**Post date:** [March 10, 2020, 7:24am UTC](https://discuss.elastic.co/t/how-to-setup-ilm-in-elastic-search/222876/1 "2020-03-10T07:24:39Z")

</div>

I am confused about creating an ILM policy with roll over when index size goes beyond 190gb.

I have followed below steps to it.

1. Defined ILM policy in elastic search.  
PUT \_ilm/policy/abcd\_foundation\_policy  
{  
"policy": {  
"phases": {  
"hot": {  
"min\_age": "0ms",  
"actions": {  
"rollover": {  
"max\_size": "190gb",  
"max\_age": "31d"  
},  
"set\_priority": {  
"priority": 100  
}  
}  
},  
"delete": {  
"min\_age": "120d",  
"actions": {  
"delete": {}  
}  
}  
}  
}  
}

2. defined "abcd\_foundation\_policy" policy in my index template with roll over alias name.  
below is the template settings.  
"index\_patterns" : [  
"_abcd\_foundation_"  
],  
"settings" : {  
"index" : {  
"lifecycle" : {  
"name" : "abcd\_foundation\_policy",  
"rollover\_alias" : "write\_abcd\_foundation"  
},  
"mapping" : {  
"ignore\_malformed" : "true"  
},  
"number\_of\_shards" : "6",  
"number\_of\_replicas" : "1"  
}  
}

I am confused with the next step . can i start pushing data into roll over alias "write\_abcd\_foundation" as defined in the template? or should I insert data first into a sample index abcd\_foundation\_00001.

I am also confused with where to define "is\_write\_index": true property for my roll over alias.

Thanks for help.

---

<div class="post-metadata">

**Author:** ![rugenl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rugenl/32/12887_2.png) [@rugenl](https://discuss.elastic.co/u/rugenl)\
**Post date:** [March 10, 2020, 1:31pm UTC](https://discuss.elastic.co/t/how-to-setup-ilm-in-elastic-search/222876/2 "2020-03-10T13:31:43Z")

</div>

You read and write via the alias.

All indices will have the alias, so reading refers to all of them. Only one can have is\_write\_alias: True, so writes are directed to it.

Rollover creates a new index -nnnnnn + 1 then sets is\_write\_alias: True for the new index causing writes to move from the old index to the new.

You can PUT to create the new index without adding a document, From the manual:

```
PUT datastream-000001
{
  "aliases": {
    "datastream": {
      "is_write_index": true
    }
  }
}
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 7, 2020, 1:31pm UTC](https://discuss.elastic.co/t/how-to-setup-ilm-in-elastic-search/222876/3 "2020-04-07T13:31:47Z")

</div>

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