parent
7787901a2d
commit
595e0e254e
|
@ -24,7 +24,7 @@ import org.elasticsearch.client.IndicesAdminClient;
|
|||
|
||||
/**
|
||||
*/
|
||||
public class IndicesStatsAction extends IndicesAction<IndicesStatsRequest, IndicesStats, IndicesStatsRequestBuilder> {
|
||||
public class IndicesStatsAction extends IndicesAction<IndicesStatsRequest, IndicesStatsResponse, IndicesStatsRequestBuilder> {
|
||||
|
||||
public static final IndicesStatsAction INSTANCE = new IndicesStatsAction();
|
||||
public static final String NAME = "indices/stats";
|
||||
|
@ -34,8 +34,8 @@ public class IndicesStatsAction extends IndicesAction<IndicesStatsRequest, Indic
|
|||
}
|
||||
|
||||
@Override
|
||||
public IndicesStats newResponse() {
|
||||
return new IndicesStats();
|
||||
public IndicesStatsResponse newResponse() {
|
||||
return new IndicesStatsResponse();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.elasticsearch.client.internal.InternalIndicesAdminClient;
|
|||
* <p>All the stats to be returned can be cleared using {@link #clear()}, at which point, specific
|
||||
* stats can be enabled.
|
||||
*/
|
||||
public class IndicesStatsRequestBuilder extends BroadcastOperationRequestBuilder<IndicesStatsRequest, IndicesStats, IndicesStatsRequestBuilder> {
|
||||
public class IndicesStatsRequestBuilder extends BroadcastOperationRequestBuilder<IndicesStatsRequest, IndicesStatsResponse, IndicesStatsRequestBuilder> {
|
||||
|
||||
public IndicesStatsRequestBuilder(IndicesAdminClient indicesClient) {
|
||||
super((InternalIndicesAdminClient) indicesClient, new IndicesStatsRequest());
|
||||
|
@ -115,7 +115,7 @@ public class IndicesStatsRequestBuilder extends BroadcastOperationRequestBuilder
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(ActionListener<IndicesStats> listener) {
|
||||
protected void doExecute(ActionListener<IndicesStatsResponse> listener) {
|
||||
((IndicesAdminClient) client).stats(request, listener);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,15 +38,15 @@ import java.util.Set;
|
|||
|
||||
/**
|
||||
*/
|
||||
public class IndicesStats extends BroadcastOperationResponse implements ToXContent {
|
||||
public class IndicesStatsResponse extends BroadcastOperationResponse implements ToXContent {
|
||||
|
||||
private ShardStats[] shards;
|
||||
|
||||
IndicesStats() {
|
||||
IndicesStatsResponse() {
|
||||
|
||||
}
|
||||
|
||||
IndicesStats(ShardStats[] shards, ClusterState clusterState, int totalShards, int successfulShards, int failedShards, List<ShardOperationFailedException> shardFailures) {
|
||||
IndicesStatsResponse(ShardStats[] shards, ClusterState clusterState, int totalShards, int successfulShards, int failedShards, List<ShardOperationFailedException> shardFailures) {
|
||||
super(totalShards, successfulShards, failedShards, shardFailures);
|
||||
this.shards = shards;
|
||||
}
|
|
@ -50,7 +50,7 @@ import static com.google.common.collect.Lists.newArrayList;
|
|||
|
||||
/**
|
||||
*/
|
||||
public class TransportIndicesStatsAction extends TransportBroadcastOperationAction<IndicesStatsRequest, IndicesStats, TransportIndicesStatsAction.IndexShardStatsRequest, ShardStats> {
|
||||
public class TransportIndicesStatsAction extends TransportBroadcastOperationAction<IndicesStatsRequest, IndicesStatsResponse, TransportIndicesStatsAction.IndexShardStatsRequest, ShardStats> {
|
||||
|
||||
private final IndicesService indicesService;
|
||||
|
||||
|
@ -101,7 +101,7 @@ public class TransportIndicesStatsAction extends TransportBroadcastOperationActi
|
|||
|
||||
|
||||
@Override
|
||||
protected IndicesStats newResponse(IndicesStatsRequest request, AtomicReferenceArray shardsResponses, ClusterState clusterState) {
|
||||
protected IndicesStatsResponse newResponse(IndicesStatsRequest request, AtomicReferenceArray shardsResponses, ClusterState clusterState) {
|
||||
int successfulShards = 0;
|
||||
int failedShards = 0;
|
||||
List<ShardOperationFailedException> shardFailures = null;
|
||||
|
@ -121,7 +121,7 @@ public class TransportIndicesStatsAction extends TransportBroadcastOperationActi
|
|||
successfulShards++;
|
||||
}
|
||||
}
|
||||
return new IndicesStats(shards.toArray(new ShardStats[shards.size()]), clusterState, shardsResponses.length(), successfulShards, failedShards, shardFailures);
|
||||
return new IndicesStatsResponse(shards.toArray(new ShardStats[shards.size()]), clusterState, shardsResponses.length(), successfulShards, failedShards, shardFailures);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -72,9 +72,9 @@ import org.elasticsearch.action.admin.indices.segments.IndicesSegmentsRequestBui
|
|||
import org.elasticsearch.action.admin.indices.settings.UpdateSettingsRequest;
|
||||
import org.elasticsearch.action.admin.indices.settings.UpdateSettingsRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.settings.UpdateSettingsResponse;
|
||||
import org.elasticsearch.action.admin.indices.stats.IndicesStats;
|
||||
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest;
|
||||
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
|
||||
import org.elasticsearch.action.admin.indices.status.IndicesStatusRequest;
|
||||
import org.elasticsearch.action.admin.indices.status.IndicesStatusRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.status.IndicesStatusResponse;
|
||||
|
@ -157,12 +157,12 @@ public interface IndicesAdminClient {
|
|||
/**
|
||||
* Indices stats.
|
||||
*/
|
||||
ActionFuture<IndicesStats> stats(IndicesStatsRequest request);
|
||||
ActionFuture<IndicesStatsResponse> stats(IndicesStatsRequest request);
|
||||
|
||||
/**
|
||||
* Indices stats.
|
||||
*/
|
||||
void stats(IndicesStatsRequest request, ActionListener<IndicesStats> listener);
|
||||
void stats(IndicesStatsRequest request, ActionListener<IndicesStatsResponse> listener);
|
||||
|
||||
/**
|
||||
* Indices stats.
|
||||
|
|
|
@ -89,10 +89,10 @@ import org.elasticsearch.action.admin.indices.settings.UpdateSettingsAction;
|
|||
import org.elasticsearch.action.admin.indices.settings.UpdateSettingsRequest;
|
||||
import org.elasticsearch.action.admin.indices.settings.UpdateSettingsRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.settings.UpdateSettingsResponse;
|
||||
import org.elasticsearch.action.admin.indices.stats.IndicesStats;
|
||||
import org.elasticsearch.action.admin.indices.stats.IndicesStatsAction;
|
||||
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest;
|
||||
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
|
||||
import org.elasticsearch.action.admin.indices.status.IndicesStatusAction;
|
||||
import org.elasticsearch.action.admin.indices.status.IndicesStatusRequest;
|
||||
import org.elasticsearch.action.admin.indices.status.IndicesStatusRequestBuilder;
|
||||
|
@ -341,12 +341,12 @@ public abstract class AbstractIndicesAdminClient implements InternalIndicesAdmin
|
|||
}
|
||||
|
||||
@Override
|
||||
public ActionFuture<IndicesStats> stats(final IndicesStatsRequest request) {
|
||||
public ActionFuture<IndicesStatsResponse> stats(final IndicesStatsRequest request) {
|
||||
return execute(IndicesStatsAction.INSTANCE, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stats(final IndicesStatsRequest request, final ActionListener<IndicesStats> listener) {
|
||||
public void stats(final IndicesStatsRequest request, final ActionListener<IndicesStatsResponse> listener) {
|
||||
execute(IndicesStatsAction.INSTANCE, request, listener);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
package org.elasticsearch.rest.action.admin.indices.stats;
|
||||
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.admin.indices.stats.IndicesStats;
|
||||
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest;
|
||||
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
|
||||
import org.elasticsearch.action.support.IgnoreIndices;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.common.Strings;
|
||||
|
@ -109,9 +109,9 @@ public class RestIndicesStatsAction extends BaseRestHandler {
|
|||
indicesStatsRequest.flush(request.paramAsBoolean("flush", indicesStatsRequest.flush()));
|
||||
indicesStatsRequest.warmer(request.paramAsBoolean("warmer", indicesStatsRequest.warmer()));
|
||||
|
||||
client.admin().indices().stats(indicesStatsRequest, new ActionListener<IndicesStats>() {
|
||||
client.admin().indices().stats(indicesStatsRequest, new ActionListener<IndicesStatsResponse>() {
|
||||
@Override
|
||||
public void onResponse(IndicesStats response) {
|
||||
public void onResponse(IndicesStatsResponse response) {
|
||||
try {
|
||||
XContentBuilder builder = RestXContentBuilder.restContentBuilder(request);
|
||||
builder.startObject();
|
||||
|
@ -146,9 +146,9 @@ public class RestIndicesStatsAction extends BaseRestHandler {
|
|||
indicesStatsRequest.indices(splitIndices(request.param("index")));
|
||||
indicesStatsRequest.types(splitTypes(request.param("types")));
|
||||
|
||||
client.admin().indices().stats(indicesStatsRequest, new ActionListener<IndicesStats>() {
|
||||
client.admin().indices().stats(indicesStatsRequest, new ActionListener<IndicesStatsResponse>() {
|
||||
@Override
|
||||
public void onResponse(IndicesStats response) {
|
||||
public void onResponse(IndicesStatsResponse response) {
|
||||
try {
|
||||
XContentBuilder builder = RestXContentBuilder.restContentBuilder(request);
|
||||
builder.startObject();
|
||||
|
@ -184,9 +184,9 @@ public class RestIndicesStatsAction extends BaseRestHandler {
|
|||
indicesStatsRequest.indices(splitIndices(request.param("index")));
|
||||
indicesStatsRequest.types(splitTypes(request.param("types")));
|
||||
|
||||
client.admin().indices().stats(indicesStatsRequest, new ActionListener<IndicesStats>() {
|
||||
client.admin().indices().stats(indicesStatsRequest, new ActionListener<IndicesStatsResponse>() {
|
||||
@Override
|
||||
public void onResponse(IndicesStats response) {
|
||||
public void onResponse(IndicesStatsResponse response) {
|
||||
try {
|
||||
XContentBuilder builder = RestXContentBuilder.restContentBuilder(request);
|
||||
builder.startObject();
|
||||
|
@ -228,9 +228,9 @@ public class RestIndicesStatsAction extends BaseRestHandler {
|
|||
indicesStatsRequest.types(splitTypes(request.param("indexingTypes2")));
|
||||
}
|
||||
|
||||
client.admin().indices().stats(indicesStatsRequest, new ActionListener<IndicesStats>() {
|
||||
client.admin().indices().stats(indicesStatsRequest, new ActionListener<IndicesStatsResponse>() {
|
||||
@Override
|
||||
public void onResponse(IndicesStats response) {
|
||||
public void onResponse(IndicesStatsResponse response) {
|
||||
try {
|
||||
XContentBuilder builder = RestXContentBuilder.restContentBuilder(request);
|
||||
builder.startObject();
|
||||
|
@ -272,9 +272,9 @@ public class RestIndicesStatsAction extends BaseRestHandler {
|
|||
indicesStatsRequest.groups(Strings.splitStringByCommaToArray(request.param("searchGroupsStats2")));
|
||||
}
|
||||
|
||||
client.admin().indices().stats(indicesStatsRequest, new ActionListener<IndicesStats>() {
|
||||
client.admin().indices().stats(indicesStatsRequest, new ActionListener<IndicesStatsResponse>() {
|
||||
@Override
|
||||
public void onResponse(IndicesStats response) {
|
||||
public void onResponse(IndicesStatsResponse response) {
|
||||
try {
|
||||
XContentBuilder builder = RestXContentBuilder.restContentBuilder(request);
|
||||
builder.startObject();
|
||||
|
@ -309,9 +309,9 @@ public class RestIndicesStatsAction extends BaseRestHandler {
|
|||
indicesStatsRequest.clear().get(true);
|
||||
indicesStatsRequest.indices(splitIndices(request.param("index")));
|
||||
|
||||
client.admin().indices().stats(indicesStatsRequest, new ActionListener<IndicesStats>() {
|
||||
client.admin().indices().stats(indicesStatsRequest, new ActionListener<IndicesStatsResponse>() {
|
||||
@Override
|
||||
public void onResponse(IndicesStats response) {
|
||||
public void onResponse(IndicesStatsResponse response) {
|
||||
try {
|
||||
XContentBuilder builder = RestXContentBuilder.restContentBuilder(request);
|
||||
builder.startObject();
|
||||
|
@ -347,9 +347,9 @@ public class RestIndicesStatsAction extends BaseRestHandler {
|
|||
indicesStatsRequest.indices(splitIndices(request.param("index")));
|
||||
indicesStatsRequest.types(splitTypes(request.param("types")));
|
||||
|
||||
client.admin().indices().stats(indicesStatsRequest, new ActionListener<IndicesStats>() {
|
||||
client.admin().indices().stats(indicesStatsRequest, new ActionListener<IndicesStatsResponse>() {
|
||||
@Override
|
||||
public void onResponse(IndicesStats response) {
|
||||
public void onResponse(IndicesStatsResponse response) {
|
||||
try {
|
||||
XContentBuilder builder = RestXContentBuilder.restContentBuilder(request);
|
||||
builder.startObject();
|
||||
|
@ -385,9 +385,9 @@ public class RestIndicesStatsAction extends BaseRestHandler {
|
|||
indicesStatsRequest.indices(splitIndices(request.param("index")));
|
||||
indicesStatsRequest.types(splitTypes(request.param("types")));
|
||||
|
||||
client.admin().indices().stats(indicesStatsRequest, new ActionListener<IndicesStats>() {
|
||||
client.admin().indices().stats(indicesStatsRequest, new ActionListener<IndicesStatsResponse>() {
|
||||
@Override
|
||||
public void onResponse(IndicesStats response) {
|
||||
public void onResponse(IndicesStatsResponse response) {
|
||||
try {
|
||||
XContentBuilder builder = RestXContentBuilder.restContentBuilder(request);
|
||||
builder.startObject();
|
||||
|
@ -423,9 +423,9 @@ public class RestIndicesStatsAction extends BaseRestHandler {
|
|||
indicesStatsRequest.indices(splitIndices(request.param("index")));
|
||||
indicesStatsRequest.types(splitTypes(request.param("types")));
|
||||
|
||||
client.admin().indices().stats(indicesStatsRequest, new ActionListener<IndicesStats>() {
|
||||
client.admin().indices().stats(indicesStatsRequest, new ActionListener<IndicesStatsResponse>() {
|
||||
@Override
|
||||
public void onResponse(IndicesStats response) {
|
||||
public void onResponse(IndicesStatsResponse response) {
|
||||
try {
|
||||
XContentBuilder builder = RestXContentBuilder.restContentBuilder(request);
|
||||
builder.startObject();
|
||||
|
@ -461,9 +461,9 @@ public class RestIndicesStatsAction extends BaseRestHandler {
|
|||
indicesStatsRequest.indices(splitIndices(request.param("index")));
|
||||
indicesStatsRequest.types(splitTypes(request.param("types")));
|
||||
|
||||
client.admin().indices().stats(indicesStatsRequest, new ActionListener<IndicesStats>() {
|
||||
client.admin().indices().stats(indicesStatsRequest, new ActionListener<IndicesStatsResponse>() {
|
||||
@Override
|
||||
public void onResponse(IndicesStats response) {
|
||||
public void onResponse(IndicesStatsResponse response) {
|
||||
try {
|
||||
XContentBuilder builder = RestXContentBuilder.restContentBuilder(request);
|
||||
builder.startObject();
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package org.elasticsearch.test.integration.indices.stats;
|
||||
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
||||
import org.elasticsearch.action.admin.indices.stats.IndicesStats;
|
||||
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
|
||||
import org.elasticsearch.action.get.GetResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.test.integration.AbstractNodesTests;
|
||||
|
@ -71,7 +71,7 @@ public class SimpleIndexStatsTests extends AbstractNodesTests {
|
|||
|
||||
client.admin().indices().prepareRefresh().execute().actionGet();
|
||||
|
||||
IndicesStats stats = client.admin().indices().prepareStats().execute().actionGet();
|
||||
IndicesStatsResponse stats = client.admin().indices().prepareStats().execute().actionGet();
|
||||
assertThat(stats.getPrimaries().getDocs().getCount(), equalTo(3l));
|
||||
assertThat(stats.getTotal().getDocs().getCount(), equalTo(6l));
|
||||
assertThat(stats.getPrimaries().getIndexing().getTotal().getIndexCount(), equalTo(3l));
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package org.elasticsearch.test.integration.search.stats;
|
||||
|
||||
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
|
||||
import org.elasticsearch.action.admin.indices.stats.IndicesStats;
|
||||
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
|
@ -77,7 +77,7 @@ public class SearchStatsTests extends AbstractNodesTests {
|
|||
client.prepareSearch().setQuery(QueryBuilders.termQuery("field", "value")).setStats("group1", "group2").execute().actionGet();
|
||||
}
|
||||
|
||||
IndicesStats indicesStats = client.admin().indices().prepareStats().execute().actionGet();
|
||||
IndicesStatsResponse indicesStats = client.admin().indices().prepareStats().execute().actionGet();
|
||||
assertThat(indicesStats.getTotal().getSearch().getTotal().getQueryCount(), greaterThan(0l));
|
||||
assertThat(indicesStats.getTotal().getSearch().getTotal().getQueryTimeInMillis(), greaterThan(0l));
|
||||
assertThat(indicesStats.getTotal().getSearch().getTotal().getFetchCount(), greaterThan(0l));
|
||||
|
|
Loading…
Reference in New Issue