Examples of hits()


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

            for (int i = 0; i < (nodes.length * 5); i++) {
                // do a search with norms field, so we don't rely on match all filtering cache
                SearchResponse search = client.client().prepareSearch().setQuery(matchAllQuery().normsField("field")).execute().actionGet();
                logger.debug("index_count [{}], expected_count [{}]", search.hits().totalHits(), indexCounter.get());
                if (count.count() != indexCounter.get()) {
                    logger.warn("!!! search does not match, index_count [{}], expected_count [{}]", search.hits().totalHits(), indexCounter.get());
                    throw new Exception("failed test, count does not match...");
                }
            }

            logger.info("*** ROUND {}", ++numberOfRounds);
View Full Code Here

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

        assertThat(searchResponse.hits().getAt(1).id(), equalTo("3"));
        assertThat(searchResponse.hits().getAt(2).id(), equalTo("4"));
        assertThat(searchResponse.hits().getAt(3).id(), equalTo("5"));
        assertThat(searchResponse.hits().getAt(4).id(), equalTo("6"));
        assertThat(searchResponse.hits().getAt(5).id(), equalTo("2"));
        assertThat(searchResponse.hits().getAt(6).id(), equalTo("7"));

        searchResponse = client.prepareSearch().setQuery(matchAllQuery())
                .addSort(SortBuilders.geoDistanceSort("location").point(40.7143528, -74.0059731).order(SortOrder.DESC))
                .execute().actionGet();
View Full Code Here

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

        assertThat(searchResponse.hits().hits().length, equalTo(1));
        assertThat(searchResponse.hits().getAt(0).fields().size(), equalTo(1));
        assertThat(searchResponse.hits().getAt(0).fields().get("field3").value().toString(), equalTo("value3"));

        searchResponse = client.prepareSearch().setQuery(matchAllQuery()).addField("*").execute().actionGet();
        assertThat(searchResponse.hits().getTotalHits(), equalTo(1l));
        assertThat(searchResponse.hits().hits().length, equalTo(1));
        assertThat(searchResponse.hits().getAt(0).fields().size(), equalTo(2));
        assertThat(searchResponse.hits().getAt(0).fields().get("field1").value().toString(), equalTo("value1"));
        assertThat(searchResponse.hits().getAt(0).fields().get("field3").value().toString(), equalTo("value3"));
    }
View Full Code Here

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

        searchResponse = client.prepareSearch().setQuery(matchAllQuery())
                .addSort(SortBuilders.geoDistanceSort("location").point(40.7143528, -74.0059731).order(SortOrder.DESC))
                .execute().actionGet();

        assertThat(searchResponse.hits().getTotalHits(), equalTo(7l));
        assertThat(searchResponse.hits().hits().length, equalTo(7));
        assertThat(searchResponse.hits().getAt(6).id(), equalTo("1"));
        assertThat(searchResponse.hits().getAt(5).id(), equalTo("3"));
        assertThat(searchResponse.hits().getAt(4).id(), equalTo("4"));
        assertThat(searchResponse.hits().getAt(3).id(), equalTo("5"));
View Full Code Here

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

        assertThat(searchResponse.hits().getAt(0).fields().size(), equalTo(1));
        assertThat(searchResponse.hits().getAt(0).fields().get("field3").value().toString(), equalTo("value3"));

        searchResponse = client.prepareSearch().setQuery(matchAllQuery()).addField("*").execute().actionGet();
        assertThat(searchResponse.hits().getTotalHits(), equalTo(1l));
        assertThat(searchResponse.hits().hits().length, equalTo(1));
        assertThat(searchResponse.hits().getAt(0).fields().size(), equalTo(2));
        assertThat(searchResponse.hits().getAt(0).fields().get("field1").value().toString(), equalTo("value1"));
        assertThat(searchResponse.hits().getAt(0).fields().get("field3").value().toString(), equalTo("value3"));
    }
}
View Full Code Here

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

        searchResponse = client.prepareSearch().setQuery(matchAllQuery())
                .addSort(SortBuilders.geoDistanceSort("location").point(40.7143528, -74.0059731).order(SortOrder.DESC))
                .execute().actionGet();

        assertThat(searchResponse.hits().getTotalHits(), equalTo(7l));
        assertThat(searchResponse.hits().hits().length, equalTo(7));
        assertThat(searchResponse.hits().getAt(6).id(), equalTo("1"));
        assertThat(searchResponse.hits().getAt(5).id(), equalTo("3"));
        assertThat(searchResponse.hits().getAt(4).id(), equalTo("4"));
        assertThat(searchResponse.hits().getAt(3).id(), equalTo("5"));
        assertThat(searchResponse.hits().getAt(2).id(), equalTo("6"));
View Full Code Here

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

        assertThat(searchResponse.hits().getAt(0).fields().get("field3").value().toString(), equalTo("value3"));

        searchResponse = client.prepareSearch().setQuery(matchAllQuery()).addField("*").execute().actionGet();
        assertThat(searchResponse.hits().getTotalHits(), equalTo(1l));
        assertThat(searchResponse.hits().hits().length, equalTo(1));
        assertThat(searchResponse.hits().getAt(0).fields().size(), equalTo(2));
        assertThat(searchResponse.hits().getAt(0).fields().get("field1").value().toString(), equalTo("value1"));
        assertThat(searchResponse.hits().getAt(0).fields().get("field3").value().toString(), equalTo("value3"));
    }
}
View Full Code Here

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

        searchResponse = client.prepareSearch().setQuery(matchAllQuery()).addField("*").execute().actionGet();
        assertThat(searchResponse.hits().getTotalHits(), equalTo(1l));
        assertThat(searchResponse.hits().hits().length, equalTo(1));
        assertThat(searchResponse.hits().getAt(0).fields().size(), equalTo(2));
        assertThat(searchResponse.hits().getAt(0).fields().get("field1").value().toString(), equalTo("value1"));
        assertThat(searchResponse.hits().getAt(0).fields().get("field3").value().toString(), equalTo("value3"));
    }
}
View Full Code Here

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

                .addSort(SortBuilders.geoDistanceSort("location").point(40.7143528, -74.0059731).order(SortOrder.DESC))
                .execute().actionGet();

        assertThat(searchResponse.hits().getTotalHits(), equalTo(7l));
        assertThat(searchResponse.hits().hits().length, equalTo(7));
        assertThat(searchResponse.hits().getAt(6).id(), equalTo("1"));
        assertThat(searchResponse.hits().getAt(5).id(), equalTo("3"));
        assertThat(searchResponse.hits().getAt(4).id(), equalTo("4"));
        assertThat(searchResponse.hits().getAt(3).id(), equalTo("5"));
        assertThat(searchResponse.hits().getAt(2).id(), equalTo("6"));
        assertThat(searchResponse.hits().getAt(1).id(), equalTo("2"));
View Full Code Here

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

        searchResponse = client.prepareSearch().setQuery(matchAllQuery()).addField("*").execute().actionGet();
        assertThat(searchResponse.hits().getTotalHits(), equalTo(1l));
        assertThat(searchResponse.hits().hits().length, equalTo(1));
        assertThat(searchResponse.hits().getAt(0).fields().size(), equalTo(2));
        assertThat(searchResponse.hits().getAt(0).fields().get("field1").value().toString(), equalTo("value1"));
        assertThat(searchResponse.hits().getAt(0).fields().get("field3").value().toString(), equalTo("value3"));
    }
}
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.