Package org.elasticsearch.action.search

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


                        .addRange(0.5, 2.5)
                        .addUnboundedTo(1)
                )
                .execute().actionGet();

        assertThat(searchResponse.hits().totalHits(), equalTo(7l));
        GeoDistanceFacet facet = searchResponse.facets().facet("geo1");
        assertThat(facet.entries().size(), equalTo(4));

        assertThat(facet.entries().get(0).to(), closeTo(2, 0.000001));
        assertThat(facet.entries().get(0).count(), equalTo(4l));
View Full Code Here


                        .addRange(0.5, 2.5)
                        .addUnboundedTo(1)
                )
                .execute().actionGet();

        assertThat(searchResponse.hits().totalHits(), equalTo(7l));
        facet = searchResponse.facets().facet("geo1");
        assertThat(facet.entries().size(), equalTo(4));

        assertThat(facet.entries().get(0).to(), closeTo(2, 0.000001));
        assertThat(facet.entries().get(0).count(), equalTo(4l));
View Full Code Here

                        .addRange(0.5, 2.5)
                        .addUnboundedTo(1)
                )
                .execute().actionGet();

        assertThat(searchResponse.hits().totalHits(), equalTo(7l));
        facet = searchResponse.facets().facet("geo1");
        assertThat(facet.entries().size(), equalTo(4));

        assertThat(facet.entries().get(0).to(), closeTo(2, 0.000001));
        assertThat(facet.entries().get(0).count(), equalTo(4l));
View Full Code Here

                )
                .execute().actionGet();

        assertThat(Arrays.toString(searchResponse.shardFailures()), searchResponse.failedShards(), equalTo(0));

        assertThat(searchResponse.hits().totalHits(), equalTo(2l));
        GeoDistanceFacet facet = searchResponse.facets().facet("geo1");
        assertThat(facet.entries().size(), equalTo(2));

        assertThat(facet.entries().get(0).from(), closeTo(0, 0.000001));
        assertThat(facet.entries().get(0).to(), closeTo(2, 0.000001));
View Full Code Here

                .from(0).size(60).explain(true);

        SearchResponse searchResponse = client.search(searchRequest("test").source(source).searchType(DFS_QUERY_THEN_FETCH).scroll(new Scroll(timeValueMinutes(10)))).actionGet();
        assertThat("Failures " + Arrays.toString(searchResponse.shardFailures()), searchResponse.shardFailures().length, equalTo(0));

        assertThat(searchResponse.hits().totalHits(), equalTo(100l));
        assertThat(searchResponse.hits().hits().length, equalTo(60));
//        System.out.println("max_score: " + searchResponse.hits().maxScore());
        for (int i = 0; i < 60; i++) {
            SearchHit hit = searchResponse.hits().hits()[i];
//            System.out.println(hit.shard() + ": " + hit.score() + ":" +  hit.explanation());
View Full Code Here

        SearchResponse searchResponse = client.search(searchRequest("test").source(source).searchType(DFS_QUERY_THEN_FETCH).scroll(new Scroll(timeValueMinutes(10)))).actionGet();
        assertThat("Failures " + Arrays.toString(searchResponse.shardFailures()), searchResponse.shardFailures().length, equalTo(0));

        assertThat(searchResponse.hits().totalHits(), equalTo(100l));
        assertThat(searchResponse.hits().hits().length, equalTo(60));
//        System.out.println("max_score: " + searchResponse.hits().maxScore());
        for (int i = 0; i < 60; i++) {
            SearchHit hit = searchResponse.hits().hits()[i];
//            System.out.println(hit.shard() + ": " + hit.score() + ":" +  hit.explanation());
            assertThat(hit.explanation(), notNullValue());
View Full Code Here

        assertThat(searchResponse.hits().totalHits(), equalTo(100l));
        assertThat(searchResponse.hits().hits().length, equalTo(60));
//        System.out.println("max_score: " + searchResponse.hits().maxScore());
        for (int i = 0; i < 60; i++) {
            SearchHit hit = searchResponse.hits().hits()[i];
//            System.out.println(hit.shard() + ": " + hit.score() + ":" +  hit.explanation());
            assertThat(hit.explanation(), notNullValue());
            assertThat("id[" + hit.id() + "]", hit.id(), equalTo(Integer.toString(100 - i - 1)));
        }
View Full Code Here

            assertThat("id[" + hit.id() + "]", hit.id(), equalTo(Integer.toString(100 - i - 1)));
        }

        searchResponse = client.searchScroll(searchScrollRequest(searchResponse.scrollId())).actionGet();

        assertThat(searchResponse.hits().totalHits(), equalTo(100l));
        assertThat(searchResponse.hits().hits().length, equalTo(40));
        for (int i = 0; i < 40; i++) {
            SearchHit hit = searchResponse.hits().hits()[i];
            assertThat("id[" + hit.id() + "]", hit.id(), equalTo(Integer.toString(100 - 60 - 1 - i)));
        }
View Full Code Here

        }

        searchResponse = client.searchScroll(searchScrollRequest(searchResponse.scrollId())).actionGet();

        assertThat(searchResponse.hits().totalHits(), equalTo(100l));
        assertThat(searchResponse.hits().hits().length, equalTo(40));
        for (int i = 0; i < 40; i++) {
            SearchHit hit = searchResponse.hits().hits()[i];
            assertThat("id[" + hit.id() + "]", hit.id(), equalTo(Integer.toString(100 - 60 - 1 - i)));
        }
    }
View Full Code Here

        searchResponse = client.searchScroll(searchScrollRequest(searchResponse.scrollId())).actionGet();

        assertThat(searchResponse.hits().totalHits(), equalTo(100l));
        assertThat(searchResponse.hits().hits().length, equalTo(40));
        for (int i = 0; i < 40; i++) {
            SearchHit hit = searchResponse.hits().hits()[i];
            assertThat("id[" + hit.id() + "]", hit.id(), equalTo(Integer.toString(100 - 60 - 1 - i)));
        }
    }

    @Test public void testDfsQueryThenFetchWithSort() throws Exception {
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.