Reputation: 1946
Elastic-search has from/size
parameter and this size
is 10 by default. How to get all the results without pagination?
Upvotes: 2
Views: 3669
Reputation: 413
first get count of results . you can get it by count api. the put n into following method of QueryBuilder.
CountResponse response = client.prepareCount("test")
.setQuery(termQuery("_type", "type1"))
.execute()
.actionGet();
then call
n=response.getCount();
you can use setSize(n).
for non java use like this curl request.
curl -XGET 'http://localhost:9200/twitter/tweet/_count' -d '
{
"query" : {
"term" : { "user" : "kimchy" }
}
}'
more on this can be found on this link. http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-count.html
Upvotes: 3