Skip to content

Instantly share code, notes, and snippets.

@gose
Created October 30, 2019 21:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gose/a763c86b0c83fc68c8b1427f9a14b95f to your computer and use it in GitHub Desktop.
Save gose/a763c86b0c83fc68c8b1427f9a14b95f to your computer and use it in GitHub Desktop.
PUT _cluster/settings
{
"transient": {
"indices.lifecycle.poll_interval": "5s"
}
}
DELETE test*
GET _cat/indices/test*?v
GET _cat/shards/test*?v
GET _ilm/policy/my_policy
# Create an ILM Policy
PUT _ilm/policy/my_policy
{
"policy": {
"phases": {
"hot": {
"actions": {
"rollover": {
"max_docs": 2
}
}
},
"warm": {
"min_age": "0ms",
"actions": {
"allocate": {
"number_of_replicas": 0,
"require": {
"data": "warm"
}
}
}
},
"delete": {
"min_age": "30d",
"actions": {
"delete": {}
}
}
}
}
}
GET _template/my_template
# Create an Index Template
PUT _template/my_template
{
"index_patterns": ["test-*"],
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1,
"index.lifecycle.name": "my_policy",
"index.lifecycle.rollover_alias": "test-alias"
}
}
# Create an Index
PUT test-000001
{
"aliases": {
"test-alias":{
"is_write_index": true
}
}
}
GET _cat/shards/test*?v
# Create 3 documents in that index
POST test-alias/_doc/1
{
"foo": "bar"
}
POST test-alias/_doc/2
{
"foo": "bar"
}
GET _cat/indices/test*?v
GET _cat/shards/test*?v
GET test-alias/_search
POST test-alias/_doc/3
{
"foo": "bar"
}
GET _cat/indices/test*?v
GET _cat/shards/test*?v
GET test-alias/_search
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment