Examples of prepareIndex()


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

                    .execute().actionGet();
        }

        int[] numbers = new int[RANGE_QUERIES];
        for (; i < QUERIES; i++) {
            client.prepareIndex("test", PercolatorService.TYPE_NAME, Integer.toString(i))
                    .setSource(jsonBuilder().startObject()
                            .field("query", rangeQuery("numeric1").from(i).to(i))
                            .endObject())
                    .execute().actionGet();
            numbers[i - TERM_QUERIES] = i;
View Full Code Here

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

        int ID_RANGE = 100;
        System.out.println("Indexing [" + COUNT + "] ...");
        int i = 1;
        for (; i <= COUNT; i++) {
//            client1.admin().cluster().preparePingSingle("test", "type1", Integer.toString(i)).execute().actionGet();
            client1.prepareIndex("test", "type1").setId(Integer.toString(i % ID_RANGE)).setSource(source(Integer.toString(i), "test" + i))
                    .setCreate(false).execute().actionGet();
            if ((i % 10000) == 0) {
                System.out.println("Indexed " + i + " took " + stopWatch.stop().lastTaskTime());
                stopWatch.start();
            }
View Full Code Here

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


            System.out.println("--> indexing: " + NUM_DOCS + " documents...");
            BulkRequestBuilder bulkBuilder = client.prepareBulk();
            for (int i = 0; i < NUM_DOCS; i++) {
                bulkBuilder.add(client.prepareIndex(INDEX, "doc").setSource("num", i));
                if (i % BULK_SIZE == 0) {
                    // Send off bulk request
                    bulkBuilder.get();
                    // Create a new holder
                    bulkBuilder = client.prepareBulk();
View Full Code Here

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

            client = NodeBuilder.nodeBuilder().client(true).node().client();
        } else {
            client = node.client();
        }

        client.prepareIndex("test", "type1", "1").setSource("field1", "value1").execute().actionGet();

        StopWatch stopWatch = new StopWatch().start();
        for (long i = 0; i < OPERATIONS; i++) {
            client.prepareGet("test", "type1", "1").execute().actionGet();
        }
View Full Code Here

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

                fieldCount = 0;
                System.out.println("dynamic fields rolled up");
            }

            builder.add(
                    client.prepareIndex(INDEX_NAME, TYPE_NAME, String.valueOf(i))
                            .setSource(sourceBuilder)
            );

            if (builder.numberOfActions() >= 1000) {
                builder.get();
View Full Code Here

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

                    .addMapping("type1", mapping)
                    .execute().actionGet();

            System.err.println("--> Indexing [" + NUM_DOCS + "]");
            for (long i = 0; i < NUM_DOCS; ) {
                client.prepareIndex("test", "type1", Long.toString(i++)).setSource(jsonBuilder().startObject()
                        .field("name", "New York")
                        .startObject("location").field("lat", 40.7143528).field("lon", -74.0059731).endObject()
                        .endObject()).execute().actionGet();

                // to NY: 5.286 km
View Full Code Here

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

                        .field("name", "New York")
                        .startObject("location").field("lat", 40.7143528).field("lon", -74.0059731).endObject()
                        .endObject()).execute().actionGet();

                // to NY: 5.286 km
                client.prepareIndex("test", "type1", Long.toString(i++)).setSource(jsonBuilder().startObject()
                        .field("name", "Times Square")
                        .startObject("location").field("lat", 40.759011).field("lon", -73.9844722).endObject()
                        .endObject()).execute().actionGet();

                // to NY: 0.4621 km
View Full Code Here

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

                        .field("name", "Times Square")
                        .startObject("location").field("lat", 40.759011).field("lon", -73.9844722).endObject()
                        .endObject()).execute().actionGet();

                // to NY: 0.4621 km
                client.prepareIndex("test", "type1", Long.toString(i++)).setSource(jsonBuilder().startObject()
                        .field("name", "Tribeca")
                        .startObject("location").field("lat", 40.718266).field("lon", -74.007819).endObject()
                        .endObject()).execute().actionGet();

                // to NY: 1.258 km
View Full Code Here

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

                        .field("name", "Tribeca")
                        .startObject("location").field("lat", 40.718266).field("lon", -74.007819).endObject()
                        .endObject()).execute().actionGet();

                // to NY: 1.258 km
                client.prepareIndex("test", "type1", Long.toString(i++)).setSource(jsonBuilder().startObject()
                        .field("name", "Soho")
                        .startObject("location").field("lat", 40.7247222).field("lon", -74).endObject()
                        .endObject()).execute().actionGet();

                // to NY: 8.572 km
View Full Code Here

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

                        .field("name", "Soho")
                        .startObject("location").field("lat", 40.7247222).field("lon", -74).endObject()
                        .endObject()).execute().actionGet();

                // to NY: 8.572 km
                client.prepareIndex("test", "type1", Long.toString(i++)).setSource(jsonBuilder().startObject()
                        .field("name", "Brooklyn")
                        .startObject("location").field("lat", 40.65).field("lon", -73.95).endObject()
                        .endObject()).execute().actionGet();

                if ((i % 10000) == 0) {
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.