Skip to content

Instantly share code, notes, and snippets.

@aravindputrevu
Created March 26, 2021 10:55
Show Gist options
  • Save aravindputrevu/71c422e2e79b361964be0958e20f6c33 to your computer and use it in GitHub Desktop.
Save aravindputrevu/71c422e2e79b361964be0958e20f6c33 to your computer and use it in GitHub Desktop.
elastic-ilm-slm

#github gist at #https://ela.st/ilm-slm-gist

PUT _ilm/policy/my-policy { "policy": { "phases": { "hot": { "actions": { "rollover": { "max_age": "2m", "max_size": "2kb", "max_docs": 2 }, "set_priority": { "priority": 100 } }, "min_age": "0ms" }, "warm": { "min_age": "0d", "actions": { "set_priority": { "priority": 50 } } } } } }

#index lifecycle policy GET _ilm/policy/my-policy

#index template GET _index_template/my-index-template

PUT _cluster/settings { "transient": { "indices.lifecycle.poll_interval": "15s" } }

#doc count and size GET _cat/indices/my-index-ilm?v

#create data stream POST my-index-ilm/_doc { "@timestamp": "2021-03-26", "username": "aravind", "message": "This is ILM Demo " }

POST my-index-ilm/_doc { "@timestamp": "2021-03-27", "username": "aravind", "message": "This is 2nd ILM Demo " }

POST my-index-ilm/_doc { "@timestamp": "2021-03-27", "username": "aravind", "message": "This is 3rd ILM Demo " }

POST my-index-ilm/_doc { "@timestamp": "2021-03-31", "username": "aravind", "message": "This is 4th ILM Demo " }

#doc count and size GET _cat/indices/my-index-ilm?v

POST my-index-ilm/_refresh

#find the data stream GET my-index-ilm/

GET my-index-ilm/_search

GET my-index-ilm/_ilm/explain

GET _cat/indices/my-index-*?v

DELETE _data_stream/my-index-ilm

#using stack monitoring you can find which node the data has moved on to

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