Setsize for java api elasticsearch

how to set fetch size for elasticseaarch Java API.
is it a good practice to setSize method of a query in elasticsearch Java API?

1 Like

Thank you for your answer @Pakoenator. I also heard that scroll is the ideal solution for fetching the huge data from elasticsearch. If you have any example of Scroll please share it here.

Thank you very much @Pakoenator. That helped me a lot. I have another use case where i have to categorize the data based on some value and get the data using TopHits aggregation. Is there a possibility to do the same scroll option here?