Bird
Raised Fist0
Elasticsearchquery~20 mins

Node roles (master, data, ingest) in Elasticsearch - Practice Problems & Coding Challenges

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Challenge - 5 Problems
🎖️
Elasticsearch Node Roles Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the output of the cluster health API for a single master-eligible node?

Consider an Elasticsearch cluster with only one node configured as master-eligible but not data or ingest. What will the cluster.health API report for the number_of_data_nodes?

Elasticsearch
GET /_cluster/health
A{"number_of_data_nodes":0}
B{"number_of_data_nodes":1}
C{"number_of_data_nodes":-1}
D{"number_of_data_nodes":null}
Attempts:
2 left
💡 Hint

Master nodes do not hold data unless explicitly configured.

Predict Output
intermediate
2:00remaining
What happens when an ingest node processes a document?

Given a node configured only as an ingest node, what is the expected behavior when a document is sent to it for indexing?

Elasticsearch
PUT /my-index/_doc/1
{
  "field": "value"
}
AThe ingest node processes the document pipeline and forwards it to a data node for storage.
BThe ingest node stores the document locally without forwarding.
CThe ingest node rejects the document with an error.
DThe ingest node converts the document to a master node for storage.
Attempts:
2 left
💡 Hint

Ingest nodes handle preprocessing but do not store data.

🧠 Conceptual
advanced
1:30remaining
Which node role is responsible for cluster state management?

In Elasticsearch, which node role primarily manages the cluster state and coordinates cluster-wide actions?

AData node
BMaster-eligible node
CIngest node
DCoordinating-only node
Attempts:
2 left
💡 Hint

Think about which node decides the cluster's overall health and configuration.

Predict Output
advanced
2:00remaining
What error occurs if a data node is down during indexing?

Assume a cluster with one master-eligible node and one data node. If the data node is down and you try to index a document, what error will Elasticsearch return?

Elasticsearch
PUT /my-index/_doc/1
{
  "field": "value"
}
A{"error":{"type":"illegal_argument_exception","reason":"cannot index on master node"}}
B{"error":{"type":"index_not_found_exception","reason":"no such index"}}
C{"error":{"type":"unavailable_shards_exception","reason":"primary shard is not active"}}
D{"error":{"type":"cluster_block_exception","reason":"blocked by: [SERVICE_UNAVAILABLE/1/no master];"}}
Attempts:
2 left
💡 Hint

Think about shard availability on data nodes.

🔧 Debug
expert
3:00remaining
Why does this cluster fail to elect a master node?

Given a cluster with three nodes, all configured as node.data: true but node.master: false, why does the cluster fail to elect a master?

node1.yml:
node.master: false
node.data: true

node2.yml:
node.master: false
node.data: true

node3.yml:
node.master: false
node.data: true
AData nodes cannot communicate with each other without a master node.
BThe cluster name is missing, causing election failure.
CThe cluster requires at least one ingest node to elect a master.
DNo node is master-eligible, so no master election can occur.
Attempts:
2 left
💡 Hint

Master election requires at least one master-eligible node.

Practice

(1/5)
1.

What is the primary role of a master node in Elasticsearch?

easy
A. Manage cluster-wide settings and coordinate nodes
B. Store and manage the actual data
C. Process incoming documents before indexing
D. Serve as a backup node for data recovery

Solution

  1. Step 1: Understand node roles in Elasticsearch

    The master node is responsible for managing the cluster state and coordinating nodes.
  2. Step 2: Differentiate master from other roles

    Data nodes store data, and ingest nodes process documents. Master nodes handle cluster-wide tasks.
  3. Final Answer:

    Manage cluster-wide settings and coordinate nodes -> Option A
  4. Quick Check:

    Master node = cluster coordination [OK]
Hint: Master node controls cluster settings and coordination [OK]
Common Mistakes:
  • Confusing master node with data node
  • Thinking ingest node manages cluster
  • Assuming master stores data
2.

Which of the following is the correct way to assign a node as a data node in the elasticsearch.yml configuration file?

node.roles: [ ? ]
easy
A. ["master"]
B. ["data"]
C. ["ingest"]
D. ["coordinating"]

Solution

  1. Step 1: Identify the role name for data nodes

    Data nodes are assigned the role "data" in the node.roles setting.
  2. Step 2: Match the correct syntax

    The correct syntax uses a list with the string "data" inside square brackets and quotes.
  3. Final Answer:

    ["data"] -> Option B
  4. Quick Check:

    node.roles: ["data"] assigns data node role [OK]
Hint: Use node.roles: ["data"] to assign data node role [OK]
Common Mistakes:
  • Using incorrect role names like "coordinating"
  • Omitting quotes around role names
  • Assigning master role instead of data
3.

Given this node configuration snippet in elasticsearch.yml:

node.roles: ["master", "ingest"]

Which tasks will this node perform?

medium
A. Only manage cluster state
B. Only process incoming documents
C. Manage cluster state and process incoming documents
D. Store data and manage cluster state

Solution

  1. Step 1: Analyze the assigned roles

    The node has roles "master" and "ingest", so it can do both tasks.
  2. Step 2: Understand what each role does

    Master manages cluster state; ingest processes incoming documents before indexing.
  3. Final Answer:

    Manage cluster state and process incoming documents -> Option C
  4. Quick Check:

    Roles master + ingest = cluster + document processing [OK]
Hint: Multiple roles mean combined tasks of those roles [OK]
Common Mistakes:
  • Assuming node can only have one role
  • Confusing ingest with data node role
  • Ignoring master role effects
4.

Look at this elasticsearch.yml snippet:

node.roles: master, data

What is the problem with this configuration?

medium
A. Roles must be listed as a YAML list with brackets and quotes
B. The roles "master" and "data" cannot be assigned together
C. The roles should be uppercase
D. The node.roles setting is deprecated

Solution

  1. Step 1: Check YAML syntax for node.roles

    Roles must be defined as a list, e.g., ["master", "data"], not as a comma-separated string.
  2. Step 2: Validate role assignment rules

    Assigning master and data roles together is allowed; roles are lowercase; node.roles is valid.
  3. Final Answer:

    Roles must be listed as a YAML list with brackets and quotes -> Option A
  4. Quick Check:

    YAML list syntax required for node.roles [OK]
Hint: Use YAML list syntax: node.roles: ["master", "data"] [OK]
Common Mistakes:
  • Writing roles as comma-separated string without brackets
  • Using uppercase role names
  • Thinking roles cannot combine
5.

You want to create a node that only processes incoming documents but does not store data or manage cluster state. Which node.roles setting should you use?

hard
A. ["master", "data"]
B. ["data"]
C. ["master"]
D. ["ingest"]

Solution

  1. Step 1: Identify the role for processing incoming documents

    The ingest role processes incoming documents before indexing.
  2. Step 2: Exclude roles that store data or manage cluster

    Data role stores data; master manages cluster state. We want neither.
  3. Final Answer:

    ["ingest"] -> Option D
  4. Quick Check:

    Only ingest role processes documents without storing or managing [OK]
Hint: Use node.roles: ["ingest"] for document processing only [OK]
Common Mistakes:
  • Choosing data role which stores data
  • Choosing master role which manages cluster
  • Combining roles unnecessarily