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?

Thanks

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

or

{
	  "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:

```
CODE
```

Use the from and size parameters of the SearchSourceBuilder object.
See https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-high-search.html#_using_the_searchsourcebuilder

Thank You :slight_smile: @dadoonet

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