Skip to content

Commit ad50afb

Browse files
committed
Simplify usage of nodes info API
Important: This breaks backwards compatibility with 0.90 * Removed endpoints: /_cluster/nodes, /_cluster/nodes/nodeId1,nodeId2 * Disallow usage of parameters, but make required metrics part of URI * Changed NodesInfoRequest to return everything by default * Fixed NPE in NodesInfoResponse Closes #4055
1 parent 6ef6bb9 commit ad50afb

File tree

7 files changed

+58
-258
lines changed

7 files changed

+58
-258
lines changed

docs/reference/cluster/nodes-info.asciidoc

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ the cluster nodes information.
66

77
[source,js]
88
--------------------------------------------------
9-
curl -XGET 'http://localhost:9200/_cluster/nodes'
10-
curl -XGET 'http://localhost:9200/_cluster/nodes/nodeId1,nodeId2'
11-
12-
# Shorter Format
139
curl -XGET 'http://localhost:9200/_nodes'
1410
curl -XGET 'http://localhost:9200/_nodes/nodeId1,nodeId2'
1511
--------------------------------------------------
@@ -19,22 +15,22 @@ The second command selectively retrieves nodes information of only
1915
`nodeId1` and `nodeId2`. All the nodes selective options are explained
2016
<<cluster-nodes,here>>.
2117

22-
By default, it just returns the attributes and core settings for a node.
23-
It also allows to get information on `settings`, `os`, `process`, `jvm`,
18+
By default, it just returns all attributes and core settings for a node.
19+
It also allows to get only information on `settings`, `os`, `process`, `jvm`,
2420
`thread_pool`, `network`, `transport`, `http` and `plugin`:
2521

2622
[source,js]
2723
--------------------------------------------------
28-
curl -XGET 'http://localhost:9200/_nodes?os=true&process=true'
29-
curl -XGET 'http://localhost:9200/_nodes/10.0.0.1/?os=true&process=true'
30-
31-
# Or, specific type endpoint:
32-
3324
curl -XGET 'http://localhost:9200/_nodes/process'
34-
curl -XGET 'http://localhost:9200/_nodes/10.0.0.1/process'
25+
curl -XGET 'http://localhost:9200/_nodes/_all/process'
26+
curl -XGET 'http://localhost:9200/_nodes/nodeId1,nodeId2/jvm,process'
27+
# same as above
28+
curl -XGET 'http://localhost:9200/_nodes/nodeId1,nodeId2/info/jvm,process'
29+
30+
curl -XGET 'http://localhost:9200/_nodes/nodeId1,nodeId2/_all
3531
--------------------------------------------------
3632

37-
The `all` flag can be set to return all the information.
33+
The `all` flag can be set to return all the information - or you can simply omit it.
3834

3935
`plugin` - if set, the result will contain details about the loaded
4036
plugins per node:

rest-api-spec/api/cluster.node_info.json

Lines changed: 2 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -3,63 +3,13 @@
33
"documentation": "http://elasticsearch.org/guide/reference/api/admin-cluster-nodes-info/",
44
"methods": ["GET"],
55
"url": {
6-
"path": "/_cluster/nodes",
7-
"paths": ["/_cluster/nodes", "/_cluster/nodes/{node_id}", "/_nodes", "/_nodes/{node_id}", "/_nodes/settings", "/_nodes/{node_id}/settings", "/_nodes/os", "/_nodes/{node_id}/os", "/_nodes/process", "/_nodes/{node_id}/process", "/_nodes/jvm", "/_nodes/{node_id}/jvm", "/_nodes/thread_pool", "/_nodes/{node_id}/thread_pool", "/_nodes/network", "/_nodes/{node_id}/network", "/_nodes/transport", "/_nodes/{node_id}/transport", "/_nodes/http", "/_nodes/{node_id}/http", "/_nodes/plugin", "/_nodes/{node_id}/plugin"],
6+
"path": "/_nodes",
7+
"paths": ["/_nodes", "/_nodes/{node_id}", "/_nodes/settings", "/_nodes/{node_id}/settings", "/_nodes/os", "/_nodes/{node_id}/os", "/_nodes/process", "/_nodes/{node_id}/process", "/_nodes/jvm", "/_nodes/{node_id}/jvm", "/_nodes/thread_pool", "/_nodes/{node_id}/thread_pool", "/_nodes/network", "/_nodes/{node_id}/network", "/_nodes/transport", "/_nodes/{node_id}/transport", "/_nodes/http", "/_nodes/{node_id}/http", "/_nodes/plugin", "/_nodes/{node_id}/plugin"],
88
"parts": {
99
"node_id": {
1010
"type" : "list",
1111
"description" : "A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes"
1212
}
13-
},
14-
"params": {
15-
"all": {
16-
"type" : "boolean",
17-
"description" : "Return all available information"
18-
},
19-
"clear": {
20-
"type" : "boolean",
21-
"description" : "Reset the default settings"
22-
},
23-
"http": {
24-
"type" : "boolean",
25-
"description" : "Return information about HTTP"
26-
},
27-
"jvm": {
28-
"type" : "boolean",
29-
"description" : "Return information about the JVM"
30-
},
31-
"network": {
32-
"type" : "boolean",
33-
"description" : "Return information about network"
34-
},
35-
"os": {
36-
"type" : "boolean",
37-
"description" : "Return information about the operating system"
38-
},
39-
"plugin": {
40-
"type" : "boolean",
41-
"description" : "Return information about plugins"
42-
},
43-
"process": {
44-
"type" : "boolean",
45-
"description" : "Return information about the Elasticsearch process"
46-
},
47-
"settings": {
48-
"type" : "boolean",
49-
"description" : "Return information about node settings"
50-
},
51-
"thread_pool": {
52-
"type" : "boolean",
53-
"description" : "Return information about the thread pool"
54-
},
55-
"timeout": {
56-
"type" : "time",
57-
"description" : "Explicit operation timeout"
58-
},
59-
"transport": {
60-
"type" : "boolean",
61-
"description" : "Return information about transport"
62-
}
6313
}
6414
},
6515
"body": null

rest-api-spec/api/cluster.node_stats.json

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
"documentation": "http://elasticsearch.org/guide/reference/api/admin-cluster-nodes-stats/",
44
"methods": ["GET"],
55
"url": {
6-
"path": "/_cluster/nodes/stats",
6+
"path": "/_nodes/stats",
77
"paths": [
8-
"/_cluster/nodes/stats",
9-
"/_cluster/nodes/{node_id}/stats",
108
"/_nodes/stats",
119
"/_nodes/{node_id}/stats",
1210
"/_nodes/stats/{metric_family}",
@@ -35,53 +33,9 @@
3533
}
3634
},
3735
"params": {
38-
"all": {
39-
"type" : "boolean",
40-
"description" : "Return all available information"
41-
},
42-
"clear": {
43-
"type" : "boolean",
44-
"description" : "Reset the default level of detail"
45-
},
4636
"fields": {
4737
"type" : "list",
4838
"description" : "A comma-separated list of fields for `fielddata` metric (supports wildcards)"
49-
},
50-
"fs": {
51-
"type" : "boolean",
52-
"description" : "Return information about the filesystem"
53-
},
54-
"http": {
55-
"type" : "boolean",
56-
"description" : "Return information about HTTP"
57-
},
58-
"indices": {
59-
"type" : "boolean",
60-
"description" : "Return information about indices"
61-
},
62-
"jvm": {
63-
"type" : "boolean",
64-
"description" : "Return information about the JVM"
65-
},
66-
"network": {
67-
"type" : "boolean",
68-
"description" : "Return information about network"
69-
},
70-
"os": {
71-
"type" : "boolean",
72-
"description" : "Return information about the operating system"
73-
},
74-
"process": {
75-
"type" : "boolean",
76-
"description" : "Return information about the Elasticsearch process"
77-
},
78-
"thread_pool": {
79-
"type" : "boolean",
80-
"description" : "Return information about the thread pool"
81-
},
82-
"transport": {
83-
"type" : "boolean",
84-
"description" : "Return information about transport"
8539
}
8640
}
8741
},

src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoRequest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@
3030
*/
3131
public class NodesInfoRequest extends NodesOperationRequest<NodesInfoRequest> {
3232

33-
private boolean settings = false;
34-
private boolean os = false;
35-
private boolean process = false;
36-
private boolean jvm = false;
37-
private boolean threadPool = false;
38-
private boolean network = false;
39-
private boolean transport = false;
40-
private boolean http = false;
41-
private boolean plugin = false;
33+
private boolean settings = true;
34+
private boolean os = true;
35+
private boolean process = true;
36+
private boolean jvm = true;
37+
private boolean threadPool = true;
38+
private boolean network = true;
39+
private boolean transport = true;
40+
private boolean http = true;
41+
private boolean plugin = true;
4242

4343
public NodesInfoRequest() {
4444
}

src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
104104

105105
if (nodeInfo.getSettings() != null) {
106106
builder.startObject("settings");
107-
Settings settings = settingsFilter.filterSettings(nodeInfo.getSettings());
107+
Settings settings = settingsFilter != null ? settingsFilter.filterSettings(nodeInfo.getSettings()) : nodeInfo.getSettings();
108108
for (Map.Entry<String, String> entry : settings.getAsMap().entrySet()) {
109109
builder.field(entry.getKey(), entry.getValue(), XContentBuilder.FieldCaseConversion.NONE);
110110
}

0 commit comments

Comments
 (0)