How to automatically apply ILM to an new index created by Firehose

0

We have a Kinesis Firehose sending logs to AWS Elasticsearch and it creates a new index each day.
I created an Index Lifecycle Policy to delete an index after 2 days and that works fine if I apply it via Kibana Index Management manually. What I need to do is apply the Policy to an index when it is created by the firehose.
The Elasticsearch docs shows this can be done with the below template but AWS Kibana does not support the index.lifecycle.name. I get an unknown setting error.
Does anyone know how I can automatically apply an ILM Policy to an Index and I must be able to wildcard it since the Firehose tacks on a date.
Thanks in advance

-------- This is the template I am trying to PUT -----------------
PUT _template/testindex_template
{
"index_patterns": ["test-index*"],
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1,
"index.lifecycle.name": "delete_index_policy"
}
}

------- This is the error -----------------
{
"error": {
"root_cause": [
{
"type": "remote_transport_exception",
"reason": "[b81eac543fece630b97c35b7b84acae3][x.x.x.x:9300][indices:admin/template/put]"
}
],
"type": "illegal_argument_exception",
"reason": "unknown setting [index.lifecycle.name] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
},
"status": 400
}

P.S. I also create a Rollover Lifecycle policy but same issue with that. The Delete policy doesn't get applied to the index that is rolled over.

KevC
asked 4 years ago746 views
3 Answers
0

Figured it out.
Need to us opendistro in the key for the template as follows:
{
"index_patterns": ["test-*"],
"settings": {
"opendistro.index_state_management.policy_id": "zero_replica_and_delete_index"
}
}

KevC
answered 4 years ago
0

See latest reply

KevC
answered 4 years ago
0

Did this work for you? If I do the same, then the templates seems to accept the "opendistro.index_state_management.policy_id" setting, but after a while - if I get the template again through the API - it was removed from the settings.

Is there another way to apply policies automatically to new indices that match a certain pattern?

Regards,
MdB

MdBdVB
answered 4 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions