Deleting an index in Elasticsearch permanently removes its stored documents and reclaims disk space across the cluster, which is useful for retiring time-based indices, removing test data, and reducing storage pressure on data nodes.
The Delete index API removes index metadata from cluster state and triggers cleanup of primary and replica shards that belong to the index. Once the deletion is acknowledged, the index name stops appearing in index listings and the shards are removed from the nodes that hosted them.
Index deletion is irreversible without a snapshot, and permissions (such as the delete_index privilege) must allow index removal. Security-enabled deployments may require HTTPS plus credentials, and wildcard deletes can remove more data than intended, so use the exact index name and validate retention requirements before running the request.
Steps to delete an index in Elasticsearch:
- List indices to confirm the exact target name.
$ curl -s "http://localhost:9200/_cat/indices?v&s=index" health status index uuid pri rep docs.count docs.deleted store.size pri.store.size dataset.size green open logs-2024.12 WTnBAnpTSNGgnUvAWw6xPA 1 0 0 0 249b 249b 249b green open logs-2025.01 98GlrCaeQae_bXpWVIp22g 1 0 1 0 4.9kb 4.9kb 4.9kb green open logs-2026.01 XJuWvI5iTzGbd_daA-Xh4g 1 0 1 0 5.4kb 5.4kb 5.4kb green open metrics-2026.01 2jVAXQGtQZW-IyCuDyu5Lw 1 0 1 0 4.9kb 4.9kb 4.9kb
Replace http://localhost:9200 with the cluster endpoint, and add authentication (for example, -u user:password) when security is enabled.
- Delete the index by name.
$ curl -s -X DELETE "http://localhost:9200/logs-2024.12?pretty" { "acknowledged" : true }Deleting an index permanently removes all documents, and wildcard targets (for example logs-*) can delete multiple indices in one request.
- Confirm the deleted index returns HTTP 404.
$ curl -s -o /dev/null -w "%{http_code}\n" -I "http://localhost:9200/logs-2024.12" 404HTTP 200 indicates the index still exists or the deletion has not propagated to the node handling the request.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
