How to get the specific document from search response Object


(JavaES) #1

Hi Guys,

SearchResponse response = srb.execute().actionGet();

I have 100 documents in my response object,but
I want to get the response from 20 th document to 40 th document from this reponse object .

Thanks for your help in advance.


(David Pilato) #2

Something like response.getHits().getHits()[20] ?


(JavaES) #3

Thanks for Your comment ,

Actually, i am sending around 67656 documents to UI from backend ,hence the performance become slow.Therefore I am trying to send the 20 documents per page ,when user clicks on second page then i need to send more 20 out of 67656 record's,

Is there any way to sort this out.


(David Pilato) #4

Have a look at size and from parameters then.

They are helping for pagination.


(system) #5