Custom Thumbnail 

drop img here or browse to upload

add answer
create album
  • feeling
  • traveling
  • watching
  • playing
  • listening
  • Happy
  • Loved
  • Sad
  • Very sad
  • Angry
  • Confused
  • Hot
  • Broken
  • expressionless
  • Cool
  • Funny
  • Tired
  • Lovely
  • Blessed
  • Shocked
  • Sleepy
  • Pretty
  • Bored

elasticsearch - index lifecycle management

elasticsearch - index lifecycle management

First we need to create a Index Lifecycle Policies. So we can define policy to delete our index and keep it simple and clean. If we manually assign this policy to a index, when the index get deleted then the policy will also remove automatically and when you create the index again it dont automatically assign to the policy. 

To solve the problem we also need a index template. So the template can include necessary setting and policy while creating again and again. We'll define rollover_alias and alias in the template so when the index will be create it can get all necessary settings. 

For example, lets say we created a policy - test-log-policy

now create a index template - test_log_template

PUT _template/test_log_template
 "index_patterns": ["*-_file_logs"],
 "settings": {
   "number_of_shards": 1,
   "number_of_replicas": 1,
   "": "test-log-policy",  
   "index.lifecycle.rollover_alias": "test-log-policy"
 "aliases" : {
   "test-log-policy" : {} 


Now when a index will create by following name pattern *-_file_logs the above template will be applied and automatically get applied to the policy  test-log-policy.

check the template details:

GET /_template/test_log_template

You can also match several templates by using wildcards like:

GET /_template/test*
GET /_template/test_log_template,template_2

To get list of all index templates you can run:

GET /_template


Be the first person to like this
    friends & family