Member-only story
Take Control of Your Cluster: A Guide to the Elasticsearch Reroute API
We’ve all been there. That heart-stopping moment when your Elasticsearch cluster's health suddenly turns yellow or red. Or maybe you notice one node is sweating under a heavy load while another is just chilling. 😱 In these moments, before you panic, you should know there’s a powerful tool in your arsenal: the Reroute API.
Think of the Reroute API as your manual override for Elasticsearch’s automatic shard allocation. It lets you play the role of a conductor, telling each shard exactly which node it should live on. This is your key to optimizing performance, recovering from failures, and keeping your cluster perfectly balanced.
In this post, we’ll break down how to use the Reroute API with practical examples, turning you into a cluster management pro.
Your Reroute API Toolbox 🔧
The Reroute API works by sending a POST request to the _cluster/reroute endpoint with a JSON payload of commands. Let's get to know the tools at your disposal.
1. move: The Relocator
This is your day-to-day workhorse. The move command does exactly what it says: it moves a shard from one node to another. It's perfect for:
- Balancing Disk Space: Shifting shards from a…
