How to auto apply index policy to newly created indexes in AWS Elasticsearch

We push Nginx logs to AWS Elasticsearch using Filebeat and Logstash. We have created an index pattern with the name nginx-error-logs* & nginx-access-logs*. We can see in Kibana that daily new indices are being created based on the nginx log file date pattern. We created index policy and applied to existing indices but we would like to auto-apply the same ISM policy for all the newly created indices in Elasticsearch. Kindly help us to achieve this?

Is this the correct format to apply in Devtools console?

PUT _template/testindex_template
  "index_patterns": ["*"],
  "settings": {
    "opendistro.index_state_management.policy_id": "index_lifecycle_management_policy"

Looks correct to me, just needs an alias.
One thing I make sure I do when I create the initial index manually is verify it is created with the write alias:

Here is a snipplet of an index template I use:


“order”: 0,
“index_patterns”: [
“opendistro”: {
“index_state_management”: {
“policy_id”: “container-rollover”,
“rollover_alias”: “containerlogs”