Examples of admin()


Examples of org.elasticsearch.client.Client.admin()

            ClusterHealthResponse clusterHealthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().setTimeout("10m").execute().actionGet();
            if (clusterHealthResponse.timedOut()) {
                System.err.println("--> Timed out waiting for cluster health");
            }
        }
        client.admin().indices().prepareRefresh().execute().actionGet();
        System.out.println("--> Number of docs in index: " + client.prepareCount().setQuery(matchAllQuery()).execute().actionGet().count());

        System.out.println("--> Running just child query");
        // run just the child query, warm up first
        for (int j = 0; j < QUERY_WARMUP; j++) {
View Full Code Here

Examples of org.elasticsearch.client.Client.admin()

        Client client = nodes.get(0).client();

        for (int index = 0; index < NUM_INDICES; index++) {
            String indexName = "index_" + index;
            System.out.println("--> Processing index [" + indexName + "]...");
            client.admin().indices().prepareCreate(indexName).setSettings(indexSettings).execute().actionGet();

            boolean flushed = false;
            for (int doc = 0; doc < NUM_DOCS; doc++) {
                if (!flushed && doc > FLUSH_AFTER) {
                    flushed = true;
View Full Code Here

Examples of org.elasticsearch.client.Client.admin()

            boolean flushed = false;
            for (int doc = 0; doc < NUM_DOCS; doc++) {
                if (!flushed && doc > FLUSH_AFTER) {
                    flushed = true;
                    client.admin().indices().prepareFlush(indexName).execute().actionGet();
                }
                client.prepareIndex(indexName, "type1", Integer.toString(doc)).setSource("field", "value" + doc).execute().actionGet();
            }
            System.out.println("--> DONE index [" + indexName + "]");
        }
View Full Code Here

Examples of org.elasticsearch.client.Client.admin()

            }
            System.out.println("--> DONE index [" + indexName + "]");
        }

        System.out.println("--> Initiating shutdown");
        client.admin().cluster().prepareNodesShutdown().setExit(false).execute().actionGet();

        System.out.println("--> Waiting for all nodes to be closed...");
        while (true) {
            boolean allAreClosed = true;
            for (Node node : nodes) {
View Full Code Here

Examples of org.elasticsearch.client.Client.admin()

        }
        client = nodes.get(0).client();

        System.out.println("--> Waiting for green status");
        while (true) {
            ClusterHealthResponse clusterHealth = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet();
            if (clusterHealth.isTimedOut()) {
                System.err.println("--> cluster health timed out..., active shards [" + clusterHealth.activeShards() + "]");
            } else {
                break;
            }
View Full Code Here

Examples of org.elasticsearch.client.Client.admin()

            client = node.client();
        }

        for (int i = 0; i < numberOfIndices; i++) {
            logger.info("START index [{}] ...", i);
            client.admin().indices().prepareCreate("index_" + i)
                    .setSettings(ImmutableSettings.settingsBuilder().put("index.number_of_shards", numberOfShards).put("index.number_of_replicas", numberOfReplicas))
                    .execute().actionGet();

            for (int j = 0; j < numberOfDocs; j++) {
                client.prepareIndex("index_" + i, "type").setSource("field1", "test", "field2", 2, "field3", new Date()).execute().actionGet();
View Full Code Here

Examples of org.elasticsearch.client.Client.admin()

                client.prepareIndex("index_" + i, "type").setSource("field1", "test", "field2", 2, "field3", new Date()).execute().actionGet();
            }
            logger.info("DONE  index [{}]", i);
        }

        client.admin().indices().prepareGatewaySnapshot().execute().actionGet();

        logger.info("closing node...");
        if (node != null) {
            node.close();
        }
View Full Code Here

Examples of org.elasticsearch.client.transport.TransportClient.admin()

            String host = locationSocket[0];
            String port = locationSocket.length > 1 ? locationSocket[1] : "9300";
            client.addTransportAddress(new InetSocketTransportAddress(host, Integer.parseInt(port)));
        }
        LOGGER.info("index %s exists?", indexName);
        IndicesExistsRequest existsRequest = client.admin().indices().prepareExists(indexName).request();
        if (client.admin().indices().exists(existsRequest).actionGet().isExists()) {
            LOGGER.info("index %s exists... deleting!", indexName);
            DeleteIndexResponse response = client.admin().indices().delete(new DeleteIndexRequest(indexName)).actionGet();
            if (!response.isAcknowledged()) {
                LOGGER.error("Failed to delete elastic search index named %s", indexName);
View Full Code Here

Examples of org.elasticsearch.client.transport.TransportClient.admin()

            String port = locationSocket.length > 1 ? locationSocket[1] : "9300";
            client.addTransportAddress(new InetSocketTransportAddress(host, Integer.parseInt(port)));
        }
        LOGGER.info("index %s exists?", indexName);
        IndicesExistsRequest existsRequest = client.admin().indices().prepareExists(indexName).request();
        if (client.admin().indices().exists(existsRequest).actionGet().isExists()) {
            LOGGER.info("index %s exists... deleting!", indexName);
            DeleteIndexResponse response = client.admin().indices().delete(new DeleteIndexRequest(indexName)).actionGet();
            if (!response.isAcknowledged()) {
                LOGGER.error("Failed to delete elastic search index named %s", indexName);
            }
View Full Code Here

Examples of org.elasticsearch.client.transport.TransportClient.admin()

        }
        LOGGER.info("index %s exists?", indexName);
        IndicesExistsRequest existsRequest = client.admin().indices().prepareExists(indexName).request();
        if (client.admin().indices().exists(existsRequest).actionGet().isExists()) {
            LOGGER.info("index %s exists... deleting!", indexName);
            DeleteIndexResponse response = client.admin().indices().delete(new DeleteIndexRequest(indexName)).actionGet();
            if (!response.isAcknowledged()) {
                LOGGER.error("Failed to delete elastic search index named %s", indexName);
            }
        }
        LOGGER.debug("END deleting elastic search index: " + indexName);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.