org.elasticsearch.action.admin.cluster.stats.ClusterStatsRequest Java Examples

The following examples show how to use org.elasticsearch.action.admin.cluster.stats.ClusterStatsRequest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ElasticsearchClient.java    From yacy_grid_mcp with GNU Lesser General Public License v2.1 5 votes vote down vote up
@SuppressWarnings("unused")
private ClusterStatsNodes getClusterStatsNodes() {
    ClusterStatsRequest clusterStatsRequest =
        new ClusterStatsRequestBuilder(elasticsearchClient.admin().cluster(), ClusterStatsAction.INSTANCE).request();
    ClusterStatsResponse clusterStatsResponse =
        elasticsearchClient.admin().cluster().clusterStats(clusterStatsRequest).actionGet();
    ClusterStatsNodes clusterStatsNodes = clusterStatsResponse.getNodesStats();
    return clusterStatsNodes;
}
 
Example #2
Source File: ElasticsearchClient.java    From yacy_grid_mcp with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Retrieve a statistic object from the connected elasticsearch cluster
 * 
 * @return cluster stats from connected cluster
 */
@SuppressWarnings("unused")
private ClusterStatsNodes getStats() {
    final ClusterStatsRequest clusterStatsRequest =
        new ClusterStatsRequestBuilder(elasticsearchClient.admin().cluster(), ClusterStatsAction.INSTANCE).request();
    final ClusterStatsResponse clusterStatsResponse =
        elasticsearchClient.admin().cluster().clusterStats(clusterStatsRequest).actionGet();
    final ClusterStatsNodes clusterStatsNodes = clusterStatsResponse.getNodesStats();
    return clusterStatsNodes;
}
 
Example #3
Source File: SharedElasticsearchResourceTest.java    From baleen with Apache License 2.0 5 votes vote down vote up
@Test
public void test() throws Exception {

  try (EmbeddedElasticsearch5 elasticsearch = new EmbeddedElasticsearch5()) {
    SharedElasticsearchResource elasticsearchResource = new SharedElasticsearchResource();

    CustomResourceSpecifier_impl esSpecifier = new CustomResourceSpecifier_impl();
    esSpecifier.setParameters(
        new Parameter[] {
          new Parameter_impl(PARAM_CLUSTER, elasticsearch.getClusterName()),
          new Parameter_impl(PARAM_PORT, Integer.toString(elasticsearch.getTransportPort()))
        });

    elasticsearchResource.initialize(esSpecifier, Maps.newHashMap());

    assertNotNull(elasticsearchResource.getClient());

    // Do something simple to check we get a response we can check
    ClusterStatsResponse actionGet =
        elasticsearchResource
            .getClient()
            .admin()
            .cluster()
            .clusterStats(new ClusterStatsRequest())
            .actionGet();
    assertEquals(elasticsearch.getClusterName(), actionGet.getClusterName().value());

    elasticsearchResource.destroy();
  }
}
 
Example #4
Source File: AbstractClient.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public ActionFuture<ClusterStatsResponse> clusterStats(ClusterStatsRequest request) {
    return execute(ClusterStatsAction.INSTANCE, request);
}
 
Example #5
Source File: AbstractClient.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void clusterStats(ClusterStatsRequest request, ActionListener<ClusterStatsResponse> listener) {
    execute(ClusterStatsAction.INSTANCE, request, listener);
}
 
Example #6
Source File: RestClusterStatsAction.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
    ClusterStatsRequest clusterStatsRequest = new ClusterStatsRequest().nodesIds(request.paramAsStringArray("nodeId", null));
    clusterStatsRequest.timeout(request.param("timeout"));
    client.admin().cluster().clusterStats(clusterStatsRequest, new RestToXContentListener<ClusterStatsResponse>(channel));
}
 
Example #7
Source File: ClusterAdminClient.java    From Elasticsearch with Apache License 2.0 2 votes vote down vote up
/**
 * Cluster wide aggregated stats.
 *
 * @param request The cluster stats request
 * @return The result future
 * @see org.elasticsearch.client.Requests#clusterStatsRequest
 */
ActionFuture<ClusterStatsResponse> clusterStats(ClusterStatsRequest request);
 
Example #8
Source File: ClusterAdminClient.java    From Elasticsearch with Apache License 2.0 2 votes vote down vote up
/**
 * Cluster wide aggregated stats
 *
 * @param request  The cluster stats request
 * @param listener A listener to be notified with a result
 * @see org.elasticsearch.client.Requests#clusterStatsRequest()
 */
void clusterStats(ClusterStatsRequest request, ActionListener<ClusterStatsResponse> listener);
 
Example #9
Source File: Requests.java    From Elasticsearch with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a cluster stats request.
 *
 * @return The cluster stats request
 * @see org.elasticsearch.client.ClusterAdminClient#clusterStats(org.elasticsearch.action.admin.cluster.stats.ClusterStatsRequest)
 */
public static ClusterStatsRequest clusterStatsRequest() {
    return new ClusterStatsRequest();
}