Nodes API


(MJay) #1

How to get only following response from the nodes API REST service GET /_nodes/

{
"_nodes": {
"total": 2,
"successful": 2,
"failed": 0
}
}


(Mark Walkom) #2

You cannot.
What are you trying to do?


(MJay) #3

Trying to get the total number of nodes in a cluster to see if all of the nodes are available and none of them are down.


(Vishnu Gt) #4

The closest you can get it is

[
	{
		"name": "node_name",
		"ram.percent": "58"
	}
]

by accessing http://localhost:9200/_cat/nodes?h=name,ram.percent&format=json

You can always get the cluster details which will contain the number of nodes by accessing http://localhost:9200/_cluster/health

{
  "cluster_name" : "testcluster",
  "status" : "yellow",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 5,
  "active_shards" : 5,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 5,
  "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
}

(MJay) #5

Thanks.


(system) #6

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.