Elasticsearch Cluster – Understanding How IT Works

Elasticsearch Cluster – How It Works

Questions will be solved

  •  How a node in cluster talks to others?
  •  What happens when a node joins or leaves the cluster?
  •  What happens when a node stops or has encountered a problem?
  •  What is the role of master/client/data in cluster ?
  •  What is memory requirement for each node ?
  •  How ES organizes data ?

What is a cluster of nodes ?

  • Start a ES instance => a cluster of single node.
  • Start another ES instance with the same cluster.name => a cluster of 2 nodes.
  • How nodes talk to each other: Over TCP
  • How nodes talk to external: JSON over HTTP
  • Each node can play one or more roles in cluster.

What is role of master/client/data ?


  • Create/Delete indices
  • Add/Remove nodes from cluster
  • Broadcast changes to other nodes
  • Only 1 master node at a time.


  • Holding data in the shards => CRUD, search, aggregations on data


  • Routing requests to master/data => smart router

Adding a node to cluster

  • It will ping all nodes => find master node => request to join => accepted & joined.
  • If joined node is data => the master will re-allocate data to this node.

Removing a node to cluster

  • The master node will remove this node from cluster, broadcast changes the all nodes.
  • If removed node is data => the master will re-allocate data.
  • If remove node is master => one of the other master nodes will be elected to be master ( Fault Detection )

How ElasticSearch organizes data ?

  • Elasticsearch as MySQL
    • Index <=> Database
    • Type <=> Table
    • Document <=> Row
    • Field <=> Column
  • Index is one or more shards distributed on muliple nodes
  • Number of primary shards can NOT be changed after index created


Leave a Reply

Your email address will not be published. Required fields are marked *