How can I fetch in between documents using Java API?


(Pinki Mondal) #1

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


(Mark Walkom) #2

How are you defining what 200 and 300 are?


(Pinki Mondal) #3

document number 200 to 300


(Mark Walkom) #4

Is that a field in the document?


(Pinki Mondal) #5

No i want number of records starting from 200 to 300


(Mark Walkom) #6

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


(Pinki Mondal) #7

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


(David Pilato) #8

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


(Pinki Mondal) #9

Thank You :slight_smile: @dadoonet


(system) closed #10

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