5.2. java api from/size does not work

(Zehra Gül Çabuk) #1


I want to paginate my search results and trying to use from-size (https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-request-from-size.html) feature.

When I send a request from console, I got right answer from my elasticsearch.
curl -XGET "localhost:9200/sampleindex/_search?pretty" -d '{"from":2,"size":1,"query":{"match_all":{}}}'

But if I use java api like below it seems that "from" part does not work because it returns first result for that query.
searchBuilder = searchBuilder.setFrom(2).setSize(1);

Could you help me how can I solve this?

Thanks in advance.

(David Pilato) #2

It should be consistent. A full reproduction example could be useful.

(Zehra Gül Çabuk) #3

That's my fault, I realized that I've set both "scroll" and "from-size" to same search builder in java and that breaks my request. Thanks for your attention.

(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.