Examples of successfulShards()


Examples of org.elasticsearch.action.count.CountResponse.successfulShards()

            // test failed (simply query that can't be parsed)
            CountResponse countResponse = client("server1").count(countRequest("test").query(Unicode.fromStringAsBytes("{ term : { _type : \"type1 } }"))).actionGet();

            assertThat(countResponse.count(), equalTo(0l));
            assertThat(countResponse.totalShards(), equalTo(5));
            assertThat(countResponse.successfulShards(), equalTo(0));
            assertThat(countResponse.failedShards(), equalTo(5));
            for (ShardOperationFailedException exp : countResponse.shardFailures()) {
                assertThat(exp.reason(), containsString("QueryParsingException"));
            }
        }
View Full Code Here

Examples of org.elasticsearch.action.search.SearchResponse.successfulShards()

        assertThat(refreshResponse.failedShards(), equalTo(0));
        for (int i = 0; i < 5; i++) {
            try {
                SearchResponse searchResponse = client("server1").search(searchRequest("test").source(Unicode.fromStringAsBytes("{ xxx }"))).actionGet();
                assertThat(searchResponse.totalShards(), equalTo(3));
                assertThat(searchResponse.successfulShards(), equalTo(0));
                assertThat(searchResponse.failedShards(), equalTo(3));
                assert false : "search should fail";
            } catch (ElasticSearchException e) {
                assertThat(e.unwrapCause(), instanceOf(SearchPhaseExecutionException.class));
                // all is well
View Full Code Here

Examples of org.elasticsearch.action.search.SearchResponse.successfulShards()

        for (int i = 0; i < 5; i++) {
            try {
                SearchResponse searchResponse = client("server1").search(searchRequest("test").source(Unicode.fromStringAsBytes("{ xxx }"))).actionGet();
                assertThat(searchResponse.totalShards(), equalTo(3));
                assertThat(searchResponse.successfulShards(), equalTo(0));
                assertThat(searchResponse.failedShards(), equalTo(3));
                assert false : "search should fail";
            } catch (ElasticSearchException e) {
                assertThat(e.unwrapCause(), instanceOf(SearchPhaseExecutionException.class));
                // all is well
View Full Code Here

Examples of org.elasticsearch.action.search.SearchResponse.successfulShards()

    @Test public void testFailedSearchWithWrongQuery() throws Exception {
        logger.info("Start Testing failed search with wrong query");
        try {
            SearchResponse searchResponse = client.search(searchRequest("test").source(Unicode.fromStringAsBytes("{ xxx }"))).actionGet();
            assertThat(searchResponse.totalShards(), equalTo(3));
            assertThat(searchResponse.successfulShards(), equalTo(0));
            assertThat(searchResponse.failedShards(), equalTo(3));
            assert false : "search should fail";
        } catch (ElasticSearchException e) {
            assertThat(e.unwrapCause(), instanceOf(SearchPhaseExecutionException.class));
            // all is well
View Full Code Here

Examples of org.elasticsearch.action.search.SearchResponse.successfulShards()

                .query(termQuery("multi", "test"))
                .from(1000).size(20).explain(true);
        SearchResponse response = client.search(searchRequest("test").searchType(DFS_QUERY_AND_FETCH).source(source)).actionGet();
        assertThat(response.hits().hits().length, equalTo(0));
        assertThat(response.totalShards(), equalTo(3));
        assertThat(response.successfulShards(), equalTo(3));
        assertThat(response.failedShards(), equalTo(0));

        response = client.search(searchRequest("test").searchType(QUERY_THEN_FETCH).source(source)).actionGet();
        assertThat(response.shardFailures().length, equalTo(0));
        assertThat(response.hits().hits().length, equalTo(0));
View Full Code Here

Examples of org.elasticsearch.action.search.SearchResponse.successfulShards()

        client1.index(indexRequest("test").type("type1").id("2").source(jsonBuilder().startObject().field("text", "lucene release").endObject())).actionGet();
        client1.admin().indices().refresh(refreshRequest()).actionGet();

        logger.info("Running moreLikeThis");
        SearchResponse mltResponse = client1.moreLikeThis(moreLikeThisRequest("test").type("type1").id("1").minTermFreq(1).minDocFreq(1)).actionGet();
        assertThat(mltResponse.successfulShards(), equalTo(5));
        assertThat(mltResponse.failedShards(), equalTo(0));
        assertThat(mltResponse.hits().totalHits(), equalTo(1l));
    }

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.