Uninstall Elasticsearch
Updated Dec 30, 2022 ·
Uninstall
To completely uninstall Elasticsearch from your system, including all configurations and data:
-
Stop the Elasticsearch Service
sudo systemctl stop elasticsearch
sudo systemctl status elasticsearch -
Uninstall Elasticsearch using the package manager:
sudo apt-get purge --auto-remove elasticsearch -
Remove all Elasticsearch configuration files and directories:
sudo rm -rf /etc/elasticsearch -
By default, Elasticsearch stores data in the following directories. Remove them to ensure complete uninstallation:
sudo rm -rf /var/lib/elasticsearch
sudo rm -rf /var/log/elasticsearch -
If Elasticsearch was manually installed (e.g., via
.tar.gzor.debfiles), locate and remove the installation directory:sudo rm -rf /usr/share/elasticsearch -
Check if any Elasticsearch-related files remain:
sudo find / -name "*elasticsearch*"Manually remove any residual files or directories.
sudo rm -rf /var/cache/apt/archives/elasticsearch_8.17.0_amd64.deb
sudo rm -rf /run/systemd/propagate/elasticsearch.service
sudo rm -rf /usr/share/keyrings/elasticsearch-keyring.gpg -
To remove any cached Elasticsearch packages:
sudo apt-get autoremove
sudo apt-get clean -
To confirm Elasticsearch is completely uninstalled, run:
curl -X GET "localhost:9200"