Skip to content

Instantly share code, notes, and snippets.

@TomonoriSoejima
Last active November 6, 2020 12:26
Show Gist options
  • Save TomonoriSoejima/9100d6455b6c9d1d6822bd3f20a1d7f3 to your computer and use it in GitHub Desktop.
Save TomonoriSoejima/9100d6455b6c9d1d6822bd3f20a1d7f3 to your computer and use it in GitHub Desktop.
rollover test
DELETE hotel*


PUT /_cluster/settings
{
    "persistent" : {
        "indices.lifecycle.poll_interval" : "10s"
    }
}


PUT /_ilm/policy/my_index_policy
{
  "policy": {
    "phases": {
      "hot": {
        "actions": {
          "rollover": {
            "max_docs": "10",
            "max_age" : "60m"
          }
        }
      }
    }
  }
}

PUT _template/hotel_template
{
  "index_patterns": ["hotel-*"],                 
  "settings": {
    "number_of_shards": 1,
    "number_of_replicas": 0,
    "index.lifecycle.name": "my_index_policy",      
    "index.lifecycle.rollover_alias": "hotel"
  }
}

DELETE hotel*

PUT hotel-000001
{
  "aliases": {
    "hotel": {
      "is_write_index": true
    }
  }
}

GET /_cat/indices/hotel*?v

GET hotel

GET _ilm/policy/my_index_policy
GET _ilm/policy


# how to force rollover

POST /hotel/_rollover 
{
  "conditions": {
    "max_docs":   "300"
  }
}


GET /_ilm/status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment