Elastic-search has from/size
parameter and this size
is 10 by default. How to get all the results without pagination?
Asked
Active
Viewed 3,213 times
2

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 Answers
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

Satya Nand kanodia
- 413
- 2
- 13
-
1You are right, but there must be a single step solution to this like `size=all` or `size=none`. – Bishal Paudel Mar 09 '15 at 10:08
-