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
已提问 4 年前747 查看次数
3 回答
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
已回答 4 年前
0

See latest reply

KevC
已回答 4 年前
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
已回答 4 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则