Package org.elasticsearch.client

Examples of org.elasticsearch.client.ClusterAdminClient


    /**
     * For issue #86: https://github.com/elasticsearch/elasticsearch-cloud-aws/issues/86
     */
    @Test
    public void testGetDeleteNonExistingSnapshot_86() {
        ClusterAdminClient client = client().admin().cluster();
        logger.info("-->  creating azure repository without any path");
        PutRepositoryResponse putRepositoryResponse = client.preparePutRepository("test-repo").setType("azure")
                .setType("s3").setSettings(ImmutableSettings.settingsBuilder()
                                .put("base_path", basePath)
                ).get();
        assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true));

        try {
            client.prepareGetSnapshots("test-repo").addSnapshots("no-existing-snapshot").get();
            fail("Shouldn't be here");
        } catch (SnapshotMissingException ex) {
            // Expected
        }

        try {
            client.prepareDeleteSnapshot("test-repo", "no-existing-snapshot").get();
            fail("Shouldn't be here");
        } catch (SnapshotMissingException ex) {
            // Expected
        }
    }
View Full Code Here


  @Override
  @SuppressWarnings("unchecked")
  public <T extends ActionResponse> T executeGet(final ClusterCallback<T> callback) {
    final Client client = node.client();
    final ClusterAdminClient clusterAdmin = client.admin().cluster();
    final ActionFuture<?> action = callback.execute(clusterAdmin);
    final T response = (T) action.actionGet();
    client.close();
    return response;
  }
View Full Code Here

    @Override
    public NodeInfo[] getNodeInfo(String clusterName) {
        Set<Node> nodeSet = nodesClusterMap.get(clusterName);
        if (nodeSet != null) {
            for (Node node : nodeSet) {
                ClusterAdminClient client = node.client().admin().cluster();
                NodesInfoResponse response = client.prepareNodesInfo().all().execute().actionGet();
                return response.getNodes();
            }
        }
        return null;
    }
View Full Code Here

    @Override
    public ClusterHealthResponse getClusterHealth(String clusterName) {
        Set<Node> nodeSet = nodesClusterMap.get(clusterName);
        if (nodeSet != null) {
            for (Node node : nodeSet) {
                ClusterAdminClient client = node.client().admin().cluster();
                ClusterHealthResponse response = client.prepareHealth().execute().actionGet();
                return response;
            }
        }
        return null;
    }
View Full Code Here

        }
        return null;
    }

    public void bindNode(Node node) {
        ClusterAdminClient client = node.client().admin().cluster();
        ClusterStatsResponse response = client.prepareClusterStats().execute().actionGet();
        String clusterName = response.getClusterNameAsString();
        Set<Node> nodeSet = nodesClusterMap.get(clusterName);
        if (nodeSet == null) {
            nodeSet = new HashSet<Node>();
            nodesClusterMap.put(clusterName, nodeSet);
View Full Code Here

        }
        nodeSet.add(node);
    }

    public void unbindNode(Node node) {
        ClusterAdminClient client = node.client().admin().cluster();
        ClusterStatsResponse response = client.prepareClusterStats().execute().actionGet();
        String clusterName = response.getClusterNameAsString();
        Set<Node> nodeSet = nodesClusterMap.get(clusterName);
        if (nodeSet != null) {
            nodeSet.remove(node);
            if (nodeSet.isEmpty()) {
View Full Code Here

        @Override
        public void run() {
            boolean reschedule = true;
            try {
                ClusterAdminClient clusterAdminClient = adminClient.cluster();

                ClusterStateResponse state = clusterAdminClient.state(clusterAdminClient.prepareState().request()).actionGet();

                if (!state.getState().nodes().getLocalNode().isMasterNode()) {
                    return;
                }
View Full Code Here

TOP

Related Classes of org.elasticsearch.client.ClusterAdminClient

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.