update-rc.d elasticsearch remove
rm -rf /etc/elasticsearch
rm -rf /var/log/elasticsearch
rm -rf /usr/share/elasticsearch
rm -rf /var/run/elasticsearch
rm -rf /var/lib/elasticsearch
rm -f /usr/lib/systemd/system/elasticsearch.service
rm -f /etc/init.d/elasticsearch
userdel elasticsearch
groupdel elasticsearch
find /var/lib/dpkg/info -iname "elasticsearch.*" -type f -delete
aptitude purge elasticsearch
github.com/elastic/elasticsearch/issues/37138#issuecomment-452000733