Master election selects a new Elasticsearch cluster master when a cluster first forms or its current master becomes unavailable. Master-eligible nodes monitor the master, vote, and let the winner resume cluster management. section 14.6.2 section 14.6.1
The process follows a practical failure-detection sequence:
- Master-eligible nodes communicate with the master and monitor its heartbeats. section 14.6.2 section 15.3.1
- When the master disappears, eligible nodes call an election and cast votes. section 14.6.2
- The elected node becomes master and resumes cluster-state management and coordination. section 14.6.2 section 14.6.3
A missed heartbeat
Suppose master-eligible node A stops receiving the master’s heartbeat. With cluster.election.initial_timeout set to its 500 ms default, A calls an election after that wait. A negative ping can trigger the election immediately instead. The elected master can then manage redistribution, replication, index management, and shard rearrangement. section 14.6.2 section 15.3.1
Election timing can be influenced by cluster.election.duration and cluster.election.initial_timeout. A master may also be replaced when cluster updates fail to commit within cluster.publish.timeout, described as 30 seconds by default. section 14.6.2 section 14.6.3
