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 年前檢視次數 770 次
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 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南