Package org.elasticsearch.action.index

Examples of org.elasticsearch.action.index.IndexResponse.matches()


        client.admin().cluster().prepareHealth().setWaitForGreenStatus().setWaitForActiveShards(4).execute().actionGet();

        for (int i = 0; i < 10; i++) {
            IndexResponse index = client.prepareIndex("test", "type1", Integer.toString(i)).setSource("field1", "value1")
                    .setPercolate("*").execute().actionGet();
            assertThat(index.matches().size(), equalTo(1));
            assertThat(index.matches(), hasItem("kuku"));
        }

        for (int i = 0; i < 10; i++) {
            IndexResponse index = client.prepareIndex("test", "type1", Integer.toString(i)).setSource("field1", "value1")
View Full Code Here


        for (int i = 0; i < 10; i++) {
            IndexResponse index = client.prepareIndex("test", "type1", Integer.toString(i)).setSource("field1", "value1")
                    .setPercolate("*").execute().actionGet();
            assertThat(index.matches().size(), equalTo(1));
            assertThat(index.matches(), hasItem("kuku"));
        }

        for (int i = 0; i < 10; i++) {
            IndexResponse index = client.prepareIndex("test", "type1", Integer.toString(i)).setSource("field1", "value1")
                    .setPercolate("color:blue").execute().actionGet();
View Full Code Here

        }

        for (int i = 0; i < 10; i++) {
            IndexResponse index = client.prepareIndex("test", "type1", Integer.toString(i)).setSource("field1", "value1")
                    .setPercolate("color:blue").execute().actionGet();
            assertThat(index.matches().size(), equalTo(1));
            assertThat(index.matches(), hasItem("kuku"));
        }

        for (int i = 0; i < 10; i++) {
            IndexResponse index = client.prepareIndex("test", "type1", Integer.toString(i)).setSource("field1", "value1")
View Full Code Here

        for (int i = 0; i < 10; i++) {
            IndexResponse index = client.prepareIndex("test", "type1", Integer.toString(i)).setSource("field1", "value1")
                    .setPercolate("color:blue").execute().actionGet();
            assertThat(index.matches().size(), equalTo(1));
            assertThat(index.matches(), hasItem("kuku"));
        }

        for (int i = 0; i < 10; i++) {
            IndexResponse index = client.prepareIndex("test", "type1", Integer.toString(i)).setSource("field1", "value1")
                    .setPercolate("color:green").execute().actionGet();
View Full Code Here

        }

        for (int i = 0; i < 10; i++) {
            IndexResponse index = client.prepareIndex("test", "type1", Integer.toString(i)).setSource("field1", "value1")
                    .setPercolate("color:green").execute().actionGet();
            assertThat(index.matches().size(), equalTo(0));
        }

        // test bulk
        BulkRequestBuilder bulkRequestBuilder = client.prepareBulk();
        for (int i = 0; i < 10; i++) {
View Full Code Here

        }
        BulkResponse bulkResponse = bulkRequestBuilder.execute().actionGet();
        assertThat(bulkResponse.hasFailures(), equalTo(false));
        for (BulkItemResponse bulkItemResponse : bulkResponse) {
            IndexResponse index = bulkItemResponse.response();
            assertThat(index.matches().size(), equalTo(1));
            assertThat(index.matches(), hasItem("kuku"));
        }
    }

    @Test public void multiplePercolators() throws Exception {
View Full Code Here

        BulkResponse bulkResponse = bulkRequestBuilder.execute().actionGet();
        assertThat(bulkResponse.hasFailures(), equalTo(false));
        for (BulkItemResponse bulkItemResponse : bulkResponse) {
            IndexResponse index = bulkItemResponse.response();
            assertThat(index.matches().size(), equalTo(1));
            assertThat(index.matches(), hasItem("kuku"));
        }
    }

    @Test public void multiplePercolators() throws Exception {
        try {
View Full Code Here

                        } else {
                            builder.field(Fields.OK, true);
                        }
                        if (itemResponse.response() instanceof IndexResponse) {
                            IndexResponse indexResponse = itemResponse.response();
                            if (indexResponse.matches() != null) {
                                builder.startArray(Fields.MATCHES);
                                for (String match : indexResponse.matches()) {
                                    builder.value(match);
                                }
                                builder.endArray();
View Full Code Here

                        }
                        if (itemResponse.response() instanceof IndexResponse) {
                            IndexResponse indexResponse = itemResponse.response();
                            if (indexResponse.matches() != null) {
                                builder.startArray(Fields.MATCHES);
                                for (String match : indexResponse.matches()) {
                                    builder.value(match);
                                }
                                builder.endArray();
                            }
                        }
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.