Package org.elasticsearch.node

Examples of org.elasticsearch.node.Node.client()


        logger.info("node closed");

        logger.info("starting node...");
        node = NodeBuilder.nodeBuilder().settings(settings).node();

        ClusterHealthResponse health = node.client().admin().cluster().prepareHealth().setTimeout("5m").setWaitForYellowStatus().execute().actionGet();
        logger.info("health: " + health.status());
        logger.info("active shards: " + health.activeShards());
        logger.info("active primary shards: " + health.activePrimaryShards());
        if (health.timedOut()) {
            logger.error("Timed out on health...");
View Full Code Here


        logger.info("active primary shards: " + health.activePrimaryShards());
        if (health.timedOut()) {
            logger.error("Timed out on health...");
        }

        ClusterState clusterState = node.client().admin().cluster().prepareState().execute().actionGet().state();
        for (int i = 0; i < numberOfIndices; i++) {
            if (clusterState.blocks().indices().containsKey("index_" + i)) {
                logger.error("index [{}] has blocks: {}", i, clusterState.blocks().indices().get("index_" + i));
            }
        }
View Full Code Here

                logger.error("index [{}] has blocks: {}", i, clusterState.blocks().indices().get("index_" + i));
            }
        }

        for (int i = 0; i < numberOfIndices; i++) {
            long count = node.client().prepareCount("index_" + i).setQuery(matchAllQuery()).execute().actionGet().count();
            if (count == numberOfDocs) {
                logger.info("VERIFIED [{}], count [{}]", i, count);
            } else {
                logger.error("FAILED [{}], expected [{}], got [{}]", i, numberOfDocs, count);
            }
View Full Code Here

        Node node = null;
        if (true) {
            client = new TransportClient().addTransportAddress(new InetSocketTransportAddress("localhost", 9300));
        } else {
            node = NodeBuilder.nodeBuilder().client(true).node();
            client = node.client();
        }

        for (int i = 0; i < numberOfIndices; i++) {
            logger.info("START index [{}] ...", i);
            client.admin().indices().prepareCreate("index_" + i)
View Full Code Here

            Node client = NodeBuilder.nodeBuilder().settings(settings).client(true).node();

            // verify that the indices are there
            for (int i = 0; i < numberOfIndices; i++) {
                try {
                    client.client().admin().indices().prepareCreate("test" + i).execute().actionGet();
                } catch (Exception e) {
                    // might already exists, fine
                }
            }
View Full Code Here

                }
            }

            logger.info("*** Waiting for GREEN status");
            try {
                ClusterHealthResponse clusterHealth = client.client().admin().cluster().prepareHealth().setWaitForGreenStatus().setTimeout("10m").execute().actionGet();
                if (clusterHealth.timedOut()) {
                    logger.warn("timed out waiting for green status....");
                }
            } catch (Exception e) {
                logger.warn("failed to execute cluster health....");
View Full Code Here

                }
            } catch (Exception e) {
                logger.warn("failed to execute cluster health....");
            }

            CountResponse count = client.client().prepareCount().setQuery(matchAllQuery()).execute().actionGet();
            logger.info("*** index_count [{}], expected_count [{}]", count.count(), indexCounter.get());
            // verify count
            for (int i = 0; i < (nodes.length * 5); i++) {
                count = client.client().prepareCount().setQuery(matchAllQuery()).execute().actionGet();
                logger.debug("index_count [{}], expected_count [{}]", count.count(), indexCounter.get());
View Full Code Here

            CountResponse count = client.client().prepareCount().setQuery(matchAllQuery()).execute().actionGet();
            logger.info("*** index_count [{}], expected_count [{}]", count.count(), indexCounter.get());
            // verify count
            for (int i = 0; i < (nodes.length * 5); i++) {
                count = client.client().prepareCount().setQuery(matchAllQuery()).execute().actionGet();
                logger.debug("index_count [{}], expected_count [{}]", count.count(), indexCounter.get());
                if (count.count() != indexCounter.get()) {
                    logger.warn("!!! count does not match, index_count [{}], expected_count [{}]", count.count(), indexCounter.get());
                    throw new Exception("failed test, count does not match...");
                }
View Full Code Here

            }

            // verify search
            for (int i = 0; i < (nodes.length * 5); i++) {
                // do a search with norms field, so we don't rely on match all filtering cache
                SearchResponse search = client.client().prepareSearch().setQuery(matchAllQuery().normsField("field")).execute().actionGet();
                logger.debug("index_count [{}], expected_count [{}]", search.hits().totalHits(), indexCounter.get());
                if (count.count() != indexCounter.get()) {
                    logger.warn("!!! search does not match, index_count [{}], expected_count [{}]", search.hits().totalHits(), indexCounter.get());
                    throw new Exception("failed test, count does not match...");
                }
View Full Code Here

            logger.info("*** ROUND {}", ++numberOfRounds);
            // bulk index data
            int numberOfBulks = numberOfDocsPerRound / bulkSize;
            for (int b = 0; b < numberOfBulks; b++) {
                BulkRequestBuilder bulk = client.client().prepareBulk();
                for (int k = 0; k < bulkSize; k++) {
                    StringBuffer sb = new StringBuffer();
                    XContentBuilder json = XContentFactory.jsonBuilder().startObject()
                            .field("field", "value" + ThreadLocalRandom.current().nextInt());

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.