Skip to content

Commit

Permalink
Indices / Nodes stats: All all flag to easily return all stats, closes
Browse files Browse the repository at this point in the history
  • Loading branch information
kimchy committed Feb 5, 2012
1 parent 1aca586 commit 6c406d0
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 0 deletions.
Expand Up @@ -51,6 +51,22 @@ public NodesStatsRequest(String... nodesIds) {
super(nodesIds);
}

/**
* Sets all the request flags.
*/
public NodesStatsRequest all() {
this.indices = true;
this.os = true;
this.process = true;
this.jvm = true;
this.threadPool = true;
this.network = true;
this.fs = true;
this.transport = true;
this.http = true;
return this;
}

/**
* Clears all the request flags.
*/
Expand Down
Expand Up @@ -37,6 +37,14 @@ public NodesStatsRequestBuilder setNodesIds(String... nodesIds) {
return this;
}

/**
* Sets all the request flags.
*/
public NodesStatsRequestBuilder all() {
request.all();
return this;
}

/**
* Clears all stats flags.
*/
Expand Down
Expand Up @@ -52,6 +52,23 @@ public IndicesStatsRequest indices(String... indices) {
return this;
}

/**
* Sets all flags to return all stats.
*/
public IndicesStatsRequest all() {
docs = true;
store = true;
get = true;
indexing = true;
search = true;
merge = true;
refresh = true;
flush = true;
types = null;
groups = null;
return this;
}

/**
* Clears all stats.
*/
Expand Down
Expand Up @@ -38,6 +38,17 @@ public IndicesStatsRequestBuilder(IndicesAdminClient indicesClient) {
super(indicesClient, new IndicesStatsRequest());
}

/**
* Sets all flags to return all stats.
*/
public IndicesStatsRequestBuilder all() {
request.all();
return this;
}

/**
* Clears all stats.
*/
public IndicesStatsRequestBuilder clear() {
request.clear();
return this;
Expand Down
Expand Up @@ -82,6 +82,10 @@ public void handleRequest(final RestRequest request, final RestChannel channel)
if (clear) {
nodesStatsRequest.clear();
}
boolean all = request.paramAsBoolean("all", false);
if (all) {
nodesStatsRequest.all();
}
nodesStatsRequest.indices(request.paramAsBoolean("indices", nodesStatsRequest.indices()));
nodesStatsRequest.os(request.paramAsBoolean("os", nodesStatsRequest.os()));
nodesStatsRequest.process(request.paramAsBoolean("process", nodesStatsRequest.process()));
Expand Down
Expand Up @@ -82,6 +82,10 @@ public void handleRequest(final RestRequest request, final RestChannel channel)
if (clear) {
indicesStatsRequest.clear();
}
boolean all = request.paramAsBoolean("all", false);
if (all) {
indicesStatsRequest.all();
}
indicesStatsRequest.indices(splitIndices(request.param("index")));
indicesStatsRequest.types(splitTypes(request.param("types")));
if (request.hasParam("groups")) {
Expand Down

0 comments on commit 6c406d0

Please sign in to comment.