Search code examples
elasticsearchdiskspacedelete-recorddisk-access

How to free up unused space after deleting documents in ElasticSearch?


When deleting records in ElasticSearch, I heard that the disk space is not freed up. So if I only wanted to keep rolling three months of documents in a type, how do I ensure that disk space is reused?


Solution

  • The system will naturally re-use the space freed up as it needs to, provided the files have been marked as such by ElasticSearch.

    However, ElasticSearch goes through a series of stages Even 'retiring' the data will not remove it from the system, only hide it away.

    This command should do what you need: DELETE /

    See here for more information: https://www.elastic.co/guide/en/elasticsearch/guide/current/retiring-data.html