Package org.elasticsearch.client.transport

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


        final CountDownLatch latch = new CountDownLatch(1);
        Thread indexer = new Thread(new Runnable() {
            @Override public void run() {
                while (!done.get()) {
                    try {
                        client.prepareIndex("test", "type").setSource("field", "value").execute().actionGet();
                        indexed.incrementAndGet();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
View Full Code Here


            int numDocs = iterations(10, 100);
            IndexRequestBuilder[] indexRequestBuilders = new IndexRequestBuilder[numDocs];
            for (int i = 0; i < numDocs; i++) {
                String id = "id" + i;
                indexRequestBuilders[i] = client.prepareIndex("test", "test", id).setSource("field", "value" + i);
            }
            indexRandom(false, indexRequestBuilders);

            String randomId = "id" + randomInt(numDocs-1);
            GetResponse getResponse = client.prepareGet("test", "test", randomId).get();
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.