2

Elastic-search has from/size parameter and this size is 10 by default. How to get all the results without pagination?

bittusarkar
  • 6,247
  • 3
  • 30
  • 50
Bishal Paudel
  • 1,896
  • 2
  • 21
  • 28
  • possible duplicate of [How to get all the values from an search result](http://stackoverflow.com/questions/4990598/how-to-get-all-the-values-from-an-search-result) – bittusarkar Mar 09 '15 at 07:25

1 Answers1

3

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

Thelonias
  • 2,918
  • 3
  • 29
  • 63