in order to setup rollover I have to
- setup ilm policy and enable rollover
- create index template and use the policy I created in step 1
- I need to config the logstash pipeline
output {
elasticsearch {
ilm_rollover_alias => "custom"
ilm_pattern => "000001"
***ilm_policy => "custom_policy"***
}
}
Just want to know.
Is the steps above correct?
Also, is there any means to define the alias...i.e. perform the task in step 3. When I creating index template in kibana? Actually I prefer to make all changes in Kibana.
I am confused the aliases in the index template. And the rollover_alias in the index settings.
I would use the API calls as opposed to using the Kibana UI. Try something like this. You can cross check the docs as well. However this should give you the basic idea.
# Create the ILM policy. We only have a hot tier.
# Rollover a shard at 50Gb or 30 days.
# Keep the index for 300 days
PUT _ilm/policy/_name_of_ilm_policy
{
"policy" : {
"phases" : {
"hot" : {
"min_age" : "0ms",
"actions" : {
"rollover" : {
"max_primary_shard_size" : "50gb",
"max_age" : "30d"
},
"set_priority" : {
"priority" : 100
}
}
},
"delete" : {
"min_age" : "30d",
"actions" : {
"delete" : {
"delete_searchable_snapshot" : true
}
}
}
}
}
}
# Step 2
# Create the new index template for the index
PUT /_index_template/name_of_template
{
"composed_of": [
"your mapping",
],
"index_patterns": [
"index_pattern_to_match-*"
],
"template": {
"settings": {
"number_of_shards": 4,
"number_of_replicas": 1,
"index.lifecycle.name": "your lifecycle name",
"index.lifecycle.rollover_alias": "your index alias",
"refresh_interval": "30s"
}
}
}
# Create the index
#The alias must be set explicitly the first time the index is created
PUT index_alias-000001
{
"aliases": {
"your index alias": {
"is_write_index" : "true"
}
}
}
Try to do it in this way
################################
PUT _ilm/policy/01-testapi-policy
{
"policy" : {
"phases" : {
"hot" : {
"min_age" : "0ms",
"actions" : {
"rollover" : {
"max_age" : "30d"
}
}
}
}
}
}
PUT /_index_template/01-testapi-template
{
"index_patterns": [
"0000-index*"
],
"template": {
"settings": {
"index.lifecycle.name": "01-testapi-policy",
"index.lifecycle.rollover_alias": "0000-indexalias",
"refresh_interval": "30s"
}
}
}
PUT 0000-indexalias-000001
{
"aliases": {
"0000-indexalias": {
"is_write_index" : "true"
}
}
}
##################################
Error come out
###################################
{
"failed_step": "check-rollover-ready",
"step_info": {
"type": "illegal_argument_exception",
"reason": "index.lifecycle.rollover_alias [0000-indexalias] does not point to index [0000-indexalias-000001]"
}
}
##########################################
Hi there,
These are API calls but from DEV tools.
I would suggest that you get it working from the Kibana console first.
If I am not mistaken, I think there is a copy as curl command in DEV tools which would allow you to turn the calls into API calls that you can call from the command line.
Kind regards.