From 38918961b72a296ee14de9d4dca0e034e353fb94 Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Tue, 15 Nov 2011 10:31:55 +0200 Subject: [PATCH] Indices Stats API: Providing groups as part of the HTTP API does not return stats for those groups, closes #1468. --- .../indices/stats/RestIndicesStatsAction.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/stats/RestIndicesStatsAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/stats/RestIndicesStatsAction.java index 25d31e96f8ce2..892fc3578d933 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/stats/RestIndicesStatsAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/stats/RestIndicesStatsAction.java @@ -82,12 +82,12 @@ public class RestIndicesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); - indicesStatsRequest.indices(splitIndices(request.param("index"))); - indicesStatsRequest.types(splitTypes(request.param("types"))); boolean clear = request.paramAsBoolean("clear", false); if (clear) { indicesStatsRequest.clear(); } + indicesStatsRequest.indices(splitIndices(request.param("index"))); + indicesStatsRequest.types(splitTypes(request.param("types"))); if (request.hasParam("groups")) { indicesStatsRequest.groups(Strings.splitStringByCommaToArray(request.param("groups"))); } @@ -128,9 +128,9 @@ class RestDocsStatsHandler implements RestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); + indicesStatsRequest.clear().docs(true); indicesStatsRequest.indices(splitIndices(request.param("index"))); indicesStatsRequest.types(splitTypes(request.param("types"))); - indicesStatsRequest.clear().docs(true); client.admin().indices().stats(indicesStatsRequest, new ActionListener() { @Override public void onResponse(IndicesStats response) { @@ -162,9 +162,9 @@ class RestStoreStatsHandler implements RestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); + indicesStatsRequest.clear().store(true); indicesStatsRequest.indices(splitIndices(request.param("index"))); indicesStatsRequest.types(splitTypes(request.param("types"))); - indicesStatsRequest.clear().store(true); client.admin().indices().stats(indicesStatsRequest, new ActionListener() { @Override public void onResponse(IndicesStats response) { @@ -196,6 +196,7 @@ class RestIndexingStatsHandler implements RestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); + indicesStatsRequest.clear().indexing(true); indicesStatsRequest.indices(splitIndices(request.param("index"))); if (request.hasParam("types")) { indicesStatsRequest.types(splitTypes(request.param("types"))); @@ -204,7 +205,6 @@ class RestIndexingStatsHandler implements RestHandler { } else if (request.hasParam("indexingTypes2")) { indicesStatsRequest.types(splitTypes(request.param("indexingTypes2"))); } - indicesStatsRequest.clear().indexing(true); client.admin().indices().stats(indicesStatsRequest, new ActionListener() { @Override public void onResponse(IndicesStats response) { @@ -236,6 +236,7 @@ class RestSearchStatsHandler implements RestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); + indicesStatsRequest.clear().search(true); indicesStatsRequest.indices(splitIndices(request.param("index"))); if (request.hasParam("groups")) { indicesStatsRequest.groups(Strings.splitStringByCommaToArray(request.param("groups"))); @@ -244,7 +245,6 @@ class RestSearchStatsHandler implements RestHandler { } else if (request.hasParam("searchGroupsStats2")) { indicesStatsRequest.groups(Strings.splitStringByCommaToArray(request.param("searchGroupsStats2"))); } - indicesStatsRequest.clear().search(true); client.admin().indices().stats(indicesStatsRequest, new ActionListener() { @Override public void onResponse(IndicesStats response) { @@ -276,8 +276,8 @@ class RestGetStatsHandler implements RestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); - indicesStatsRequest.indices(splitIndices(request.param("index"))); indicesStatsRequest.clear().get(true); + indicesStatsRequest.indices(splitIndices(request.param("index"))); client.admin().indices().stats(indicesStatsRequest, new ActionListener() { @Override public void onResponse(IndicesStats response) { @@ -309,9 +309,9 @@ class RestMergeStatsHandler implements RestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); + indicesStatsRequest.clear().merge(true); indicesStatsRequest.indices(splitIndices(request.param("index"))); indicesStatsRequest.types(splitTypes(request.param("types"))); - indicesStatsRequest.clear().merge(true); client.admin().indices().stats(indicesStatsRequest, new ActionListener() { @Override public void onResponse(IndicesStats response) { @@ -343,9 +343,9 @@ class RestFlushStatsHandler implements RestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); + indicesStatsRequest.clear().flush(true); indicesStatsRequest.indices(splitIndices(request.param("index"))); indicesStatsRequest.types(splitTypes(request.param("types"))); - indicesStatsRequest.clear().flush(true); client.admin().indices().stats(indicesStatsRequest, new ActionListener() { @Override public void onResponse(IndicesStats response) { @@ -377,9 +377,9 @@ class RestRefreshStatsHandler implements RestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); + indicesStatsRequest.clear().refresh(true); indicesStatsRequest.indices(splitIndices(request.param("index"))); indicesStatsRequest.types(splitTypes(request.param("types"))); - indicesStatsRequest.clear().refresh(true); client.admin().indices().stats(indicesStatsRequest, new ActionListener() { @Override public void onResponse(IndicesStats response) {