Package org.elasticsearch.client

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


                .build();

        Node node = NodeBuilder.nodeBuilder().settings(settings).node();
        final Client client = node.client();

        client.admin().indices().prepareCreate("test").execute().actionGet();
        client.admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet();

        final AtomicBoolean stop = new AtomicBoolean();

        Thread indexingThread = new Thread() {
View Full Code Here


        Node node = NodeBuilder.nodeBuilder().settings(settings).node();
        final Client client = node.client();

        client.admin().indices().prepareCreate("test").execute().actionGet();
        client.admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet();

        final AtomicBoolean stop = new AtomicBoolean();

        Thread indexingThread = new Thread() {
            @Override public void run() {
View Full Code Here

        Node client = nodeBuilder().settings(settingsBuilder().put(settings).put("name", "client")).client(true).node();

        Client client1 = client.client();

        Thread.sleep(1000);
        client1.admin().indices().create(createIndexRequest("test")).actionGet();
        Thread.sleep(5000);

        StopWatch stopWatch = new StopWatch().start();
        int COUNT = 200000;
        System.out.println("Indexing [" + COUNT + "] ...");
View Full Code Here

        int QUERY_WARMUP = 20;
        int QUERY_COUNT = 50;

        Thread.sleep(10000);
        try {
            client.admin().indices().create(createIndexRequest("test")).actionGet();
            client.admin().indices().preparePutMapping("test").setType("child").setSource(XContentFactory.jsonBuilder().startObject().startObject("type")
                    .startObject("_parent").field("type", "parent").endObject()
                    .endObject().endObject()).execute().actionGet();
            Thread.sleep(5000);
View Full Code Here

        int QUERY_COUNT = 50;

        Thread.sleep(10000);
        try {
            client.admin().indices().create(createIndexRequest("test")).actionGet();
            client.admin().indices().preparePutMapping("test").setType("child").setSource(XContentFactory.jsonBuilder().startObject().startObject("type")
                    .startObject("_parent").field("type", "parent").endObject()
                    .endObject().endObject()).execute().actionGet();
            Thread.sleep(5000);

            StopWatch stopWatch = new StopWatch().start();
View Full Code Here

                }
            }
            System.out.println("--> Indexing took " + stopWatch.totalTime() + ", TPS " + (((double) (COUNT * (1 + CHILD_COUNT))) / stopWatch.totalTime().secondsFrac()));
        } catch (Exception e) {
            System.out.println("--> Index already exists, ignoring indexing phase, waiting for green");
            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();
View Full Code Here

            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

        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

            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

            }
            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

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.