Elasticsearch API to add a lifecycle policy to an index template

Is there a way to update an index template to add a lifecycle policy through Elasticsearch APIs (to achieve the same effect as can be done in Kibana)?

Hi Matt,

The only way you would do this with a template is to retrieve the template with

GET /_template/my-template

Then add the index.lifecycle.name setting to what already existed in the body of the template, and then update the template

PUT /_template/my-template
  "settings": {
    <... the rest of your template's settings ...>
    "index.lifecycle.name": "delete-old-logs"

Thanks Lee - yeah, so I guess this is a bit awkward to script at present.

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