How can I delete all indices that don't have documents?

How can I delete all Elasticsearch that have no documents within? Also, is this safe ? I mean if an index has no documents then it's practically useless right?

Unless you have something using them, then yes you can delete them as they are just wasting resources.

Use the delete API endpoint - https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-index.html

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.