How can I fetch in between documents using Java API?

I want to fetch documents from 200 to 300 using search query of JAVA API implementation but unable to find any option
How to do this?


How are you defining what 200 and 300 are?

document number 200 to 300

Is that a field in the document?

No i want number of records starting from 200 to 300

I get that, but documents don't have numbers in Elasticsearch.
So how are you defining what that range is?

I am not defining anything I just want to get latest records from 200 to 300 as this option is available in curl query like

GET /_search?size=5&from=5


	  "query": {
	    "bool": {
	      "must": [
	          "term": {
	            "some key": "some value"
	  "from": 10,
	  "size": 20

I want to do this using Java API

Please format your code using </> icon as explained in this guide. It will make your post more readable.

Or use markdown style like:


Use the from and size parameters of the SearchSourceBuilder object.

Thank You :slight_smile: @dadoonet

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