diff --git a/marvel/src/main/java/org/elasticsearch/marvel/shield/SecuredClient.java b/marvel/src/main/java/org/elasticsearch/marvel/shield/SecuredClient.java index 3e7904fc7ed..f89f12da4e9 100644 --- a/marvel/src/main/java/org/elasticsearch/marvel/shield/SecuredClient.java +++ b/marvel/src/main/java/org/elasticsearch/marvel/shield/SecuredClient.java @@ -214,10 +214,6 @@ import org.elasticsearch.action.bulk.BulkAction; import org.elasticsearch.action.bulk.BulkRequest; import org.elasticsearch.action.bulk.BulkRequestBuilder; import org.elasticsearch.action.bulk.BulkResponse; -import org.elasticsearch.action.count.CountAction; -import org.elasticsearch.action.count.CountRequest; -import org.elasticsearch.action.count.CountRequestBuilder; -import org.elasticsearch.action.count.CountResponse; import org.elasticsearch.action.delete.DeleteAction; import org.elasticsearch.action.delete.DeleteRequest; import org.elasticsearch.action.delete.DeleteRequestBuilder; @@ -257,8 +253,6 @@ import org.elasticsearch.action.suggest.SuggestAction; import org.elasticsearch.action.suggest.SuggestRequest; import org.elasticsearch.action.suggest.SuggestRequestBuilder; import org.elasticsearch.action.suggest.SuggestResponse; -import org.elasticsearch.action.support.AdapterActionFuture; -import org.elasticsearch.action.support.DelegatingActionListener; import org.elasticsearch.action.termvectors.*; import org.elasticsearch.action.update.UpdateAction; import org.elasticsearch.action.update.UpdateRequest; @@ -506,28 +500,6 @@ public class SecuredClient implements Client { return new MultiSearchRequestBuilder(this, MultiSearchAction.INSTANCE); } - public ActionFuture count(CountRequest request) { - AdapterActionFuture actionFuture = new AdapterActionFuture() { - protected CountResponse convert(SearchResponse listenerResponse) { - return new CountResponse(listenerResponse); - } - }; - this.execute(SearchAction.INSTANCE, request.toSearchRequest(), actionFuture); - return actionFuture; - } - - public void count(CountRequest request, final ActionListener listener) { - this.execute(SearchAction.INSTANCE, request.toSearchRequest(), new DelegatingActionListener(listener) { - protected CountResponse getDelegatedFromInstigator(SearchResponse response) { - return new CountResponse(response); - } - }); - } - - public CountRequestBuilder prepareCount(String... indices) { - return new CountRequestBuilder(this, CountAction.INSTANCE).setIndices(indices); - } - public ActionFuture exists(ExistsRequest request) { return this.execute(ExistsAction.INSTANCE, request); } diff --git a/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/cluster/ClusterStateCollectorTests.java b/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/cluster/ClusterStateCollectorTests.java index 067f04933d3..1e4fdd4b2fa 100644 --- a/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/cluster/ClusterStateCollectorTests.java +++ b/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/cluster/ClusterStateCollectorTests.java @@ -57,7 +57,7 @@ public class ClusterStateCollectorTests extends AbstractCollectorTestCase { securedFlush(); securedRefresh(); - assertHitCount(client().prepareCount().get(), nbDocs); + assertHitCount(client().prepareSearch().setSize(0).get(), nbDocs); Collection results = newClusterStateCollector().doCollect(); assertThat(results, hasSize(1)); @@ -99,7 +99,7 @@ public class ClusterStateCollectorTests extends AbstractCollectorTestCase { securedFlush(); securedRefresh(); for (int i = 0; i < nbIndices; i++) { - assertHitCount(client().prepareCount("test-" + i).get(), docsPerIndex[i]); + assertHitCount(client().prepareSearch("test-" + i).setSize(0).get(), docsPerIndex[i]); } Collection results = newClusterStateCollector().doCollect(); diff --git a/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/indices/IndexRecoveryCollectorTests.java b/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/indices/IndexRecoveryCollectorTests.java index 29007181191..936edf3cde4 100644 --- a/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/indices/IndexRecoveryCollectorTests.java +++ b/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/indices/IndexRecoveryCollectorTests.java @@ -70,8 +70,8 @@ public class IndexRecoveryCollectorTests extends AbstractCollectorTestCase { client().prepareIndex("other", "bar").setSource("value", randomInt()).get(); flushAndRefresh(); - assertHitCount(client().prepareCount(indexName).get(), numDocs); - assertHitCount(client().prepareCount("other").get(), 1L); + assertHitCount(client().prepareSearch(indexName).setSize(0).get(), numDocs); + assertHitCount(client().prepareSearch("other").setSize(0).get(), 1L); logger.info("--> start second node"); final String node2 = internalCluster().startNode(); diff --git a/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/indices/IndexStatsCollectorTests.java b/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/indices/IndexStatsCollectorTests.java index 6490a03f0ad..955482d7579 100644 --- a/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/indices/IndexStatsCollectorTests.java +++ b/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/indices/IndexStatsCollectorTests.java @@ -48,7 +48,7 @@ public class IndexStatsCollectorTests extends AbstractCollectorTestCase { securedRefresh(); securedEnsureGreen(indexName); - assertHitCount(client().prepareCount().get(), nbDocs); + assertHitCount(client().prepareSearch().setSize(0).get(), nbDocs); Collection results = newIndexStatsCollector().doCollect(); assertThat(results, hasSize(1)); @@ -92,7 +92,7 @@ public class IndexStatsCollectorTests extends AbstractCollectorTestCase { securedEnsureGreen(indexPrefix + "*"); for (int i = 0; i < nbIndices; i++) { - assertHitCount(client().prepareCount(indexPrefix + i).get(), docsPerIndex[i]); + assertHitCount(client().prepareSearch(indexPrefix + i).setSize(0).get(), docsPerIndex[i]); } String clusterUUID = client().admin().cluster().prepareState().setMetaData(true).get().getState().metaData().clusterUUID(); diff --git a/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/shards/ShardsCollectorTests.java b/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/shards/ShardsCollectorTests.java index 940e1ddc29e..788635b149a 100644 --- a/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/shards/ShardsCollectorTests.java +++ b/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/shards/ShardsCollectorTests.java @@ -49,7 +49,7 @@ public class ShardsCollectorTests extends AbstractCollectorTestCase { ensureGreen(); refresh(); - assertHitCount(client().prepareCount().get(), nbDocs); + assertHitCount(client().prepareSearch().setSize(0).get(), nbDocs); Collection results = newShardsCollector().doCollect(); assertThat(results, hasSize(getNumShards("test-shards").totalNumShards)); @@ -117,7 +117,7 @@ public class ShardsCollectorTests extends AbstractCollectorTestCase { refresh(); for (int i = 0; i < nbIndices; i++) { - assertHitCount(client().prepareCount(indexPrefix + String.valueOf(i)).get(), nbDocsPerIndex[i]); + assertHitCount(client().prepareSearch(indexPrefix + String.valueOf(i)).setSize(0).get(), nbDocsPerIndex[i]); } Collection results = newShardsCollector().doCollect(); diff --git a/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterInfoTests.java b/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterInfoTests.java index d3541926d17..e83142cb810 100644 --- a/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterInfoTests.java +++ b/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterInfoTests.java @@ -116,7 +116,7 @@ public class ClusterInfoTests extends MarvelIntegTestCase { securedFlush(); securedRefresh(); - assertHitCount(client().prepareCount() + assertHitCount(client().prepareSearch().setSize(0) .setIndices(MarvelSettings.MARVEL_DATA_INDEX_NAME) .setTypes(ClusterInfoCollector.TYPE) .setQuery(QueryBuilders.boolQuery() diff --git a/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterStateTests.java b/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterStateTests.java index cdad3be4d5c..82471feefe5 100644 --- a/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterStateTests.java +++ b/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterStateTests.java @@ -89,7 +89,7 @@ public class ClusterStateTests extends MarvelIntegTestCase { DiscoveryNodes nodes = client().admin().cluster().prepareState().clear().setNodes(true).get().getState().nodes(); logger.debug("--> ensure that the 'nodes' attributes of the cluster state document is not indexed"); - assertHitCount(client().prepareCount() + assertHitCount(client().prepareSearch().setSize(0) .setTypes(ClusterStateCollector.TYPE) .setQuery(QueryBuilders.matchQuery("cluster_state.nodes." + nodes.masterNodeId() + ".name", nodes.masterNode().name())).get(), 0L); } diff --git a/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndexStatsTests.java b/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndexStatsTests.java index 58b28127e4b..68dec34c02d 100644 --- a/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndexStatsTests.java +++ b/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndexStatsTests.java @@ -5,7 +5,6 @@ */ package org.elasticsearch.marvel.agent.renderer.indices; -import org.elasticsearch.action.count.CountResponse; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.query.QueryBuilders; @@ -76,11 +75,12 @@ public class IndexStatsTests extends MarvelIntegTestCase { securedFlush(indices); securedRefresh(); for (int i = 0; i < nbIndices; i++) { - CountResponse count = client().prepareCount() + SearchResponse count = client().prepareSearch() + .setSize(0) .setTypes(IndexStatsCollector.TYPE) .setQuery(QueryBuilders.termQuery("index_stats.index", indices[i])) .get(); - assertThat(count.getCount(), greaterThan(0L)); + assertThat(count.getHits().totalHits(), greaterThan(0L)); } } }); diff --git a/marvel/src/test/java/org/elasticsearch/marvel/test/MarvelIntegTestCase.java b/marvel/src/test/java/org/elasticsearch/marvel/test/MarvelIntegTestCase.java index 15092f89ec5..c9b73c79c46 100644 --- a/marvel/src/test/java/org/elasticsearch/marvel/test/MarvelIntegTestCase.java +++ b/marvel/src/test/java/org/elasticsearch/marvel/test/MarvelIntegTestCase.java @@ -177,8 +177,8 @@ public abstract class MarvelIntegTestCase extends ESIntegTestCase { protected void assertMarvelDocsCount(Matcher matcher, String... types) { try { - long count = client().prepareCount(MarvelSettings.MARVEL_INDICES_PREFIX + "*") - .setTypes(types).get().getCount(); + long count = client().prepareSearch(MarvelSettings.MARVEL_INDICES_PREFIX + "*").setSize(0) + .setTypes(types).get().getHits().totalHits(); logger.trace("--> searched for [{}] documents, found [{}]", Strings.arrayToCommaDelimitedString(types), count); assertThat(count, matcher); } catch (IndexNotFoundException e) { diff --git a/shield/src/test/resources/org/elasticsearch/transport/actions b/shield/src/test/resources/org/elasticsearch/transport/actions index 36e7cff6027..1bda58cdbdc 100644 --- a/shield/src/test/resources/org/elasticsearch/transport/actions +++ b/shield/src/test/resources/org/elasticsearch/transport/actions @@ -51,7 +51,6 @@ indices:monitor/settings/get indices:monitor/shard_stores indices:monitor/stats indices:monitor/upgrade -indices:data/read/count indices:data/read/exists indices:data/read/explain indices:data/read/field_stats diff --git a/watcher/src/test/java/org/elasticsearch/watcher/test/integration/BasicWatcherTests.java b/watcher/src/test/java/org/elasticsearch/watcher/test/integration/BasicWatcherTests.java index a93aab5f000..8a0b8da06bc 100644 --- a/watcher/src/test/java/org/elasticsearch/watcher/test/integration/BasicWatcherTests.java +++ b/watcher/src/test/java/org/elasticsearch/watcher/test/integration/BasicWatcherTests.java @@ -157,7 +157,7 @@ public class BasicWatcherTests extends AbstractWatcherIntegrationTestCase { assertThat(deleteWatchResponse.isFound(), is(true)); refresh(); - assertHitCount(client().prepareCount(WatchStore.INDEX).get(), 0l); + assertHitCount(client().prepareSearch(WatchStore.INDEX).setSize(0).get(), 0l); // Deleting the same watch for the second time deleteWatchResponse = watcherClient.prepareDeleteWatch("_name").get();