How to delete Elasticsearch indices in Magento 2?

You can delete specific elastic search indices or all the available indices with the help of the Delete command.

You can run the given command to delete a specific index from the elastic search,

curl -X DELETE 'http://localhost:9200/<index_name>'

Here replace index_name with your actual elastic search index name. If you don’t know about the index name, You can get all the indices from elastic search.

Delete all indices of elastic search:

curl -X DELETE 'http://localhost:9200/_all'

This is useful while you have messed with elastic search indices and once you delete indices and run the indexer command again to push the data to elastic search indexes.