Removing a node from an Elasticsearch cluster

Explaining how to remove a node from an Elasticsearch cluster.

When managing an Elasticsearch cluster, there may be situations where you need to remove a node from the cluster. This could be due to hardware issues, maintenance, or scaling down the cluster. In this article, we will discuss the steps to safely remove a node from an Elasticsearch cluster without causing any data loss or impacting the cluster’s performance. If you want to learn about the concept of Elasticsearch nodes and the types of roles, check out this guide.

Steps to safely remove a node from an Elasticsearch cluster

1. Stop indexing and perform a synced flush (optional)

First, if you can afford to stop indexing for a short period, it is recommended to perform a synced flush. This operation helps speed up the recovery process when the cluster restarts after a node is removed. To perform a synced flush, execute the following command:

POST _flush/synced

Note that this step is optional and can be skipped if stopping indexing is not feasible.

2. Retrieve the node name

After performing a sync flush, you will need to know the node name in order to remove it from the cluster. You can retrieve the node name by executing the following command:

GET _cat/nodes?v

This command will return a list of nodes in the cluster along with their node names. Identify the node you want to remove and note down its node name.

3. Remove the node from the cluster

After you’ve determined the node name, you can remove the node from the cluster. To remove the node from the cluster, update the cluster settings to exclude the node using its node name. Execute the following command, replacing `<node_name>` with the node name you retrieved in the previous step:

PUT _cluster/settings
{
  "persistent": {
    "cluster.routing.allocation.exclude._name": "<node_name>"
  }
}

This command will instruct Elasticsearch to move all shards from the specified node to other nodes in the cluster. You can monitor the progress of shard relocation by executing the following command:

GET _cat/recovery?v&active_only=true

Wait for the shard relocation process to complete before proceeding to the next step.

4. Stop the Elasticsearch process on the node

After all shards have relocated to the other nodes, you can safely stop the Elasticsearch process on the node you want to remove. Depending on your installation method and operating system, the command to stop Elasticsearch may vary. For example, if you are using systemd on a Linux system, you can execute the following command:

sudo systemctl stop elasticsearch

5. Verify the cluster health

Finally, verify the health of the cluster by executing the following command:

GET _cluster/health


Ensure that the cluster status is “green” (meaning that all shards are properly allocated) and the number of nodes in the cluster has been reduced by one.

Elastic Cloud Serverless

Another option to avoid worrying about nodes is using Elastic Cloud Serverless. In this fully managed solution, Elastic takes care of the underlying architecture of your cluster, meaning you don’t need to worry about nodes, shards, or scaling, everything happens automagically.

Conclusion

In conclusion, removing a node from an Elasticsearch cluster involves disabling shard allocation to that node, optionally performing a synced flush, excluding the node from the cluster, and stopping the Elasticsearch process on the node. By following these steps, you can safely remove a node without impacting the cluster’s performance or causing data loss. If you are looking for a managed solution, you could use Elastic Cloud Serverless.

Ready to try this out on your own? Start a free trial.

Want to get Elastic certified? Find out when the next Elasticsearch Engineer training is running!

Related content

Testing Elasticsearch. It just got simpler.

March 19, 2026

Testing Elasticsearch. It just got simpler.

Explaining how Elasticsearch integration tests have become simpler thanks to improvements in Elasticsearch 9.x, the modern Java client, and Testcontainers 2.x.

Elasticsearch Serverless pricing demystified: VCUs and ECUs explained

December 19, 2025

Elasticsearch Serverless pricing demystified: VCUs and ECUs explained

Learn how Elasticsearch Serverless pricing works for Elastic’s fully-managed deployment offering. We explain VCUs (Search, Ingest, ML) and ECUs, detailing how consumption is based on actual allocated resources, workload complexity, and Search Power.

How excessive replica counts can degrade performance, and what to do about it

December 8, 2025

How excessive replica counts can degrade performance, and what to do about it

Learn about the impact of high replica counts in Elasticsearch, and how to ensure cluster stability by right-sizing your replicas.

How to deploy Elasticsearch on Azure AKS Automatic

November 14, 2025

How to deploy Elasticsearch on Azure AKS Automatic

Learn how to deploy Elasticsearch with Kibana on Azure using AKS Automatic and ECK for a partially managed Elasticsearch setup configuration.

Configuring recursive chunking for structured documents in Elasticsearch

November 11, 2025

Configuring recursive chunking for structured documents in Elasticsearch

Learn how to configure recursive chunking in Elasticsearch with chunk size, separator groups, and custom separator lists for optimal structured document indexing.

Ready to build state of the art search experiences?

Sufficiently advanced search isn’t achieved with the efforts of one. Elasticsearch is powered by data scientists, ML ops, engineers, and many more who are just as passionate about search as your are. Let’s connect and work together to build the magical search experience that will get you the results you want.

Try it yourself