Elastic Pagination

(Maral Erdene Tumursuh) #1

Hello Guys,

I'm using elastic search with java. My elastic query is returning 103 results, which means that if I'm paging through them (with 25 results per page) I should have 4 pages: 4 full pages and 1 page with a 3 row result.
(using setFrom and setSize).

However, my last page is still returning 25 results. It's returning the very last result as expected, but also 22 results from the previous page. How do I disable this behavior and have it just return the single result as expected?

(Christoph) #2

Could you share the code you use to page through the results?

(Maral Erdene Tumursuh) #3

here is my code,

 searchReq = ElasticConnection.getClient().prepareSearch(conn.getCoreName());

  SearchResponse searchResponse = searchReq.execute().actionGet();

(Christoph) #4

That should get you the top 25, but how do you implement the paging?

(Maral Erdene Tumursuh) #5

Thank you Sir,

I found my error. I implemented paging wrong. So i fixed it.

Here is my code


(system) #6

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