# Index Policies Error

**URL:** <https://discuss.elastic.co/t/index-policies-error/274722>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [June 2, 2021, 9:04am UTC](https://discuss.elastic.co/t/index-policies-error/274722 "2021-06-02T09:04:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin\_perez](https://avatars.discourse-cdn.com/v4/letter/m/5f8ce5/32.png) [@Martin\_perez](https://discuss.elastic.co/u/Martin_perez)\
**Post date:** [June 2, 2021, 9:04am UTC](https://discuss.elastic.co/t/index-policies-error/274722/1 "2021-06-02T09:04:40Z")

</div>

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](https://www.elastic.co/guide/en/elasticsearch/reference/master/set-up-lifecycle-policy.html)

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

```auto
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

```auto
{
  "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

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [June 2, 2021, 9:46am UTC](https://discuss.elastic.co/t/index-policies-error/274722/2 "2021-06-02T09:46:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Martin\_perez](https://avatars.discourse-cdn.com/v4/letter/m/5f8ce5/32.png) [@Martin\_perez](https://discuss.elastic.co/u/Martin_perez)\
**Post date:** [June 2, 2021, 9:48am UTC](https://discuss.elastic.co/t/index-policies-error/274722/3 "2021-06-02T09:48:26Z")

</div>

okay, i was using 7.12, thanks

---

<div class="post-metadata">

**Author:** ![andreidan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andreidan/32/78167_2.png) [@andreidan](https://discuss.elastic.co/u/andreidan)\
**Post date:** [June 2, 2021, 10:18am UTC](https://discuss.elastic.co/t/index-policies-error/274722/4 "2021-06-02T10:18:50Z")

</div>

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)

> [@Martin\_perez](#):
>
> ```auto
> 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"  
> }
> }
> }
> 
> ```

Here's the request that worked for me

```auto
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"
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![Martin\_perez](https://avatars.discourse-cdn.com/v4/letter/m/5f8ce5/32.png) [@Martin\_perez](https://discuss.elastic.co/u/Martin_perez)\
**Post date:** [June 2, 2021, 10:31am UTC](https://discuss.elastic.co/t/index-policies-error/274722/5 "2021-06-02T10:31:43Z")

</div>

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

---

<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:** [June 30, 2021, 10:32am UTC](https://discuss.elastic.co/t/index-policies-error/274722/6 "2021-06-30T10:32:28Z")

</div>

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