Elasticsearch - Cluster APIs - elasticsearch - elasticsearch tutorial - elastic search
Elasticsearch Cluster APIs
- Most cluster level APIs allow to specify which nodes to execute on (for example, getting the node stats for a node).
- Nodes can be identified in the APIs either using their internal node id, the node name, address, custom attributes, or just the _local node receiving the request.

learn elasticsearch tutorials - node cluster Example
For example:
GET http://localhost:9200/_nodes/_local
Clicking "Copy Code" button will copy the code into the clipboard - memory. Please paste(Ctrl+V) it in your destination. The code will get pasted. Happy coding from Wikitechy - elasticsearch - elasticsearch tutorial - elastic - elastic search - elasticsearch docker team
elasticsearch - elasticsearch tutorial - elastic search - elasticsearch sort - elasticsearch list indexes - elasticsearch node
Response
{
"cluster_name":"elasticsearch", "nodes":{
"Vy3KxqcHQdm4cIM22U1ewA":{
"name":"Red Guardian", "transport_address":"127.0.0.1:9300",
"host":"127.0.0.1", "ip":"127.0.0.1", "version":"2.1.1",
"build":"40e2c53", "http_address":"127.0.0.1:9200",
}
}
}
Clicking "Copy Code" button will copy the code into the clipboard - memory. Please paste(Ctrl+V) it in your destination. The code will get pasted. Happy coding from Wikitechy - elasticsearch - elasticsearch tutorial - elastic - elastic search - elasticsearch docker team

Or
Response
- Same as in the above example.
Cluster Health
- This API is used to get the status on the health of the cluster by appending health keyword.
For example:
GET http://localhost:9200/_cluster/health
Clicking "Copy Code" button will copy the code into the clipboard - memory. Please paste(Ctrl+V) it in your destination. The code will get pasted. Happy coding from Wikitechy - elasticsearch - elasticsearch tutorial - elastic - elastic search - elasticsearch docker team
elasticsearch - elasticsearch tutorial - elastic search - elasticsearch sort - elasticsearch list indexes - elasticsearch node
Response
{
"cluster_name":"elasticsearch", "status":"yellow", "timed_out":false,
"number_of_nodes":1, "number_of_data_nodes":1, "active_primary_shards":23,
"active_shards":23, "relocating_shards":0, "initializing_shards":0,
"unassigned_shards":23, "delayed_unassigned_shards":0, "number_of_pending_tasks":0,
"number_of_in_flight_fetch":0, "task_max_waiting_in_queue_millis":0,
"active_shards_percent_as_number":50.0
}
Clicking "Copy Code" button will copy the code into the clipboard - memory. Please paste(Ctrl+V) it in your destination. The code will get pasted. Happy coding from Wikitechy - elasticsearch - elasticsearch tutorial - elastic - elastic search - elasticsearch docker team
Cluster State
- This API is used to get state information about a cluster by appending ‘state’ keyword URL.
- The state information contains version, master node, other nodes, routing table, metadata and blocks.

learn elasticsearch tutorials - elasticsearch clusters indexers Example
For example:
GET http://localhost:9200/_cluster/state 10. Elasticsearch - Cluster APIs
Clicking "Copy Code" button will copy the code into the clipboard - memory. Please paste(Ctrl+V) it in your destination. The code will get pasted. Happy coding from Wikitechy - elasticsearch - elasticsearch tutorial - elastic - elastic search - elasticsearch docker team
elasticsearch - elasticsearch tutorial - elastic search - elasticsearch sort - elasticsearch list indexes - elasticsearch node
Response
{
"cluster_name":"elasticsearch", "version":27, "state_uuid":"B3P7uHGKQUGsSsiX2rGYUQ",
"master_node":"Vy3KxqcHQdm4cIM22U1ewA",
}
Clicking "Copy Code" button will copy the code into the clipboard - memory. Please paste(Ctrl+V) it in your destination. The code will get pasted. Happy coding from Wikitechy - elasticsearch - elasticsearch tutorial - elastic - elastic search - elasticsearch docker team
Cluster Stats
- This API helps to retrieve statistics about cluster by using ‘stats’ keyword.
- This API returns shard number, store size, memory usage, number of nodes, roles, OS, and file system.
For example:
GET http://localhost:9200/_cluster/stats
Clicking "Copy Code" button will copy the code into the clipboard - memory. Please paste(Ctrl+V) it in your destination. The code will get pasted. Happy coding from Wikitechy - elasticsearch - elasticsearch tutorial - elastic - elastic search - elasticsearch docker team
elasticsearch - elasticsearch tutorial - elastic search - elasticsearch sort - elasticsearch list indexes - elasticsearch node
Response
{
"timestamp":1454496710020, "cluster_name":"elasticsearch", "status":"yellow",
"indices":{
"count":5, "shards":{
"total":23, "primaries":23, "replication":0.0,"
}
}
}
Clicking "Copy Code" button will copy the code into the clipboard - memory. Please paste(Ctrl+V) it in your destination. The code will get pasted. Happy coding from Wikitechy - elasticsearch - elasticsearch tutorial - elastic - elastic search - elasticsearch docker team
Pending Cluster Tasks
- This API is used for monitoring pending tasks in any cluster.
- Tasks are like create index, update mapping, allocate shard, fail shard etc.
elasticsearch - elasticsearch tutorial - elastic search - elasticsearch sort - elasticsearch list indexes - elasticsearch node
For example:
GET http://localhost:9200/_cluster/pending_tasks
Clicking "Copy Code" button will copy the code into the clipboard - memory. Please paste(Ctrl+V) it in your destination. The code will get pasted. Happy coding from Wikitechy - elasticsearch - elasticsearch tutorial - elastic - elastic search - elasticsearch docker team
Cluster Reroute
- This API is used for moving shard from one node to another or to cancel any allocation or allocate any unassigned shard.
For example:
POST http://localhost:9200/_cluster/reroute
Clicking "Copy Code" button will copy the code into the clipboard - memory. Please paste(Ctrl+V) it in your destination. The code will get pasted. Happy coding from Wikitechy - elasticsearch - elasticsearch tutorial - elastic - elastic search - elasticsearch docker team
Request Body
{
"commands" : [
{
"move" :
{
"index" : "schools", "shard" : 2,
"from_node" : "nodea", "to_node" : "nodeb"
}
},
{
"allocate" : {
"index" : "test", "shard" : 1, "node" : "nodec"
}
}
]
}
Clicking "Copy Code" button will copy the code into the clipboard - memory. Please paste(Ctrl+V) it in your destination. The code will get pasted. Happy coding from Wikitechy - elasticsearch - elasticsearch tutorial - elastic - elastic search - elasticsearch docker team
Cluster Update Settings
- This API allows you to update the settings of a cluster by using settings keyword.
- There are two types of settings - persistent (applied across restarts) and transient (do not survive a full cluster restart).
Cluster APIs: Node specification
- Most cluster level APIs allow to specify which nodes to execute on (for example, getting the node stats for a node).
- Nodes can be identified in the APIs either using their internal node id, the node name, address, custom attributes, or just the _local node receiving the request.
- For example, here are some sample executions of nodes info:
# Local
curl localhost:9200/_nodes/_local
# Address
curl localhost:9200/_nodes/10.0.0.3,10.0.0.4
curl localhost:9200/_nodes/10.0.0.*
# Names
curl localhost:9200/_nodes/node_name_goes_here
curl localhost:9200/_nodes/node_name_goes_*
# Attributes (set something like node.rack: 2 in the config)
curl localhost:9200/_nodes/rack:2
curl localhost:9200/_nodes/ra*:2
curl localhost:9200/_nodes/ra*:2*
Clicking "Copy Code" button will copy the code into the clipboard - memory. Please paste(Ctrl+V) it in your destination. The code will get pasted. Happy coding from Wikitechy - elasticsearch - elasticsearch tutorial - elastic - elastic search - elasticsearch docker team
Node Stats
- This API is used to retrieve the statistics of one more nodes of the cluster.
- Node stats are almost the same as cluster.
elasticsearch - elasticsearch tutorial - elastic search - elasticsearch sort - elasticsearch list indexes - elasticsearch node
For example:
GET http://localhost:9200/_nodes/stats
Clicking "Copy Code" button will copy the code into the clipboard - memory. Please paste(Ctrl+V) it in your destination. The code will get pasted. Happy coding from Wikitechy - elasticsearch - elasticsearch tutorial - elastic - elastic search - elasticsearch docker team
Response
{
"cluster_name":"elasticsearch", "nodes":{
"Vy3KxqcHQdm4cIM22U1ewA":{
"timestamp":1454497097572, "name":"Red Guardian",
"transport_address":"127.0.0.1:9300", "host":"127.0.0.1", "ip":["127.0.0.1:9300",
}
}
}
Clicking "Copy Code" button will copy the code into the clipboard - memory. Please paste(Ctrl+V) it in your destination. The code will get pasted. Happy coding from Wikitechy - elasticsearch - elasticsearch tutorial - elastic - elastic search - elasticsearch docker team
elasticsearch - elasticsearch tutorial - elastic search - elasticsearch sort - elasticsearch list indexes - elasticsearch node
Nodes hot_threads
- This API helps you to retrieve information about the current hot threads on each node in cluster.
elasticsearch - elasticsearch tutorial - elastic search - elasticsearch sort - elasticsearch list indexes - elasticsearch node
For example:
GET http://localhost:9200/_nodes/hot_threads
Clicking "Copy Code" button will copy the code into the clipboard - memory. Please paste(Ctrl+V) it in your destination. The code will get pasted. Happy coding from Wikitechy - elasticsearch - elasticsearch tutorial - elastic - elastic search - elasticsearch docker team
Response
{Red Guardian} {Vy3KxqcHQdm4cIM22U1ewA} {127.0.0.1}{127.0.0.1:9300}Hot threads at
2016-02-03T10:59:48.856Z, interval = 500ms, busiestThreads = 3,
ignoreIdleThreads = true:0.0% (0s out of 500ms) cpu usage by thread 'Attach Listener'
unique snapshot
unique snapshot