Index Policies Error

Hi, I have a problem with ILM, index life management, since I have followed the steps that appear in this guide Configure a lifecycle policy | Elasticsearch Guide [master] | Elastic

My current index pattern is called filebeat-2021.06

The index template that I created is called templateindex

The name of the index policy is Filebeat_Policies

PUT _index_template / my_template { "index_patterns" : [ "templateindex ], 

    
  "template" : { "settings" : { "number_of_shards" : 1 , "number_of_replicas" : 1 , "index.lifecycle.name" : "templateindex" , 
     
       
       
        
      "index.lifecycle.rollover_alias" : "Filebeat_policies"  
    }
  }
}

The error it gives me when putting it in the dev tools is the following

{
  "error" : "Incorrect HTTP method for uri [/_index_template?pretty=true] and method [PUT], allowed: [GET]",
  "status" : 405
}

Thank you very much, I am quite desperate, if someone can help me I will be very grateful

It looks like the _index_template endpoint was added in Elasticsearch 7.8. Which version are you using?

okay, i was using 7.12, thanks

Thanks for using Elasticsearch!

The request you're trying to execute has several problems (spaces in the URL, missing ending quotes in the index_patterns array)

Here's the request that worked for me

PUT _index_template/my_template
{
  "index_patterns": [
    "templateindex"
  ],
  "template": {
    "settings": {
      "number_of_shards": 1,
      "number_of_replicas": 1,
      "index.lifecycle.name": "templateindex",
      "index.lifecycle.rollover_alias": "Filebeat_policies"
    }
  }
}

That`s works for me. I am very grateful to you, this helps me a lot in my project

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