Remove or delete old data from elastic search Remove or delete old data from elastic search elasticsearch elasticsearch

Remove or delete old data from elastic search


You can do that with delete by query plugin.

Assuming you have some timestamp or creation date field in your index, your query would look something like this

DELETE /your_index/your_type/_query{  "query": {    "range": {      "timestamp": {        "lte": "now-10y"      }    }  }}

This will delete records older than 10 years.

I hope this helps


Split data to daily indexes and use alias as old index name. then Delete the each index daily. just as logstash:

Daily indices :logstash-20151011,logstash-20151012,logstash-20151013.

Full Alias: logstash

Then daily delete last index.


If you are using time-based indices, that should be something like:

curl -XDELETE http://localhost:9200/test-2017-06