user12056260
user12056260

Reputation:

Filter the Elasticsearch cat API

I am using the _cat API of elasticsearch to get the various details of my elasticsearch cluster.

https://www.elastic.co/guide/en/elasticsearch/reference/current/cat.html

What I want is the ability to filter the response which I can't see in the documentation, for example output of _cat/node?v give the node.role which tells whether a node is data or master or ingest node and I want a way to filter the only master and data node in the response.

Upvotes: 1

Views: 2354

Answers (1)

A l w a y s S u n n y
A l w a y s S u n n y

Reputation: 38502

You can use GET /_cat/master instead of _cat/nodes?v to get the master node. Otherwise, you can use the /_nodes/data:true to get only data nodes

GET /_nodes/data:true
GET /_nodes/ingest:true
GET /_nodes/master:true

Upvotes: 1

Related Questions