Add ILM to existing index

Hi,
im having an index called 'jenkins_jobs_logs' and i want to add ILM policy.
after some investigation, i understood that i must perform a reindex.
i reindex to the ILM pattern(jenkins_jobs_logs --> jenkins_jobs_logs-000001):

POST _reindex
{
  "source": {
    "index": "jenkins_jobs_logs"
  },
  "dest": {
    "index": "jenkins_jobs_logs-000001"
  }
}

## create ILM
PUT _ilm/policy/jenkins_jobs_logs
{
  "policy": {
    "phases": {
      "hot": {
        "min_age": "0ms",
        "actions": {
          "rollover": {
            "max_age": "30d",
            "max_size": "50gb"
          },
          "set_priority": {
            "priority": 100
          }
        }
      }
    }
  }
}

## Create template, you can change this latter for shard etc..
PUT _index_template/my_monitoring
{
  "index_patterns": ["jenkins_jobs_logs-*"],
  "template": {
    "settings": {
      "number_of_shards": 3,
      "number_of_replicas": 0,
      "index.lifecycle.name": "jenkins_jobs_logs",
      "index.lifecycle.rollover_alias": "jenkins_jobs_logs"
    }
  }
}

Now what i should do?
do I need to create aמ alias? i tried this but got an error that index/alias already exists...

## Create alias

# PUT <my-index-{now/d}-000001>
PUT %3Cjenkins_jobs_logs-%7Bnow%2Fd%7D-000001%3E
{
  "aliases": {
    "jenkins_jobs_logs": {
      "is_write_index": true
    }
  }
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.