ILM deleted after run

I've created an ILM that deletes data after x days.

PUT idx*/_settings
{
  "index": {
    "lifecycle": {
      "name": "x-days-policy"
    }
  }
}

The data gets deleted only once and then the ILM is removed.

GET idx/_ilm/explain

{
  "indices" : {
    "idx" : {
      "index" : "idx",
      "managed" : false
      }
    }
}

I want it to work forever of course and not put the ILM manually every time.
How can I set an ILM on an index so that it stays there forever?

You need to set it on the template of your index, are you using templates for your index?

Dont think so. Ill try and start over with creating the indices based on templates. In kibana there does not seem to be a way to create index through gui so I ended up doing "PUT /myindex"