How to stop/shut down an elasticsearch node?

If you just want to apply new config you don't need to shut it down.

$ sudo service elasticsearch restart

But if you want to shut it down anyway:

$ sudo service elasticsearch stop

OR

$ sudo systemctl stop elasticsearch.service

$ sudo systemctl restart elasticsearch.service

Docker:

docker restart <elasticsearch-container-name or id>


Updated answer.

_shutdown API has been removed in elasticsearch 2.x.

Some options:

  • In your terminal (dev mode basically), just type "Ctrl-C"

  • If you started it as a daemon (-d) find the PID and kill the process: SIGTERM will shut Elasticsearch down cleanly (kill -15 PID)

  • If running as a service, run something like service elasticsearch stop:

    • Linux
    • Windows

Previous answer. It's now deprecated from 1.6.

Yeah. See admin cluster nodes shutdown documentation

Basically:

# Shutdown local node
$ curl -XPOST 'http://localhost:9200/_cluster/nodes/_local/_shutdown'

# Shutdown all nodes in the cluster
$ curl -XPOST 'http://localhost:9200/_shutdown'