First, you can send a request for the full number of entries in the index.
curl -X GET 'http://localhost:9200/documents/document/_count?pretty=true' { "count" : 1408, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 } }
Then you will need to loop through the set using a combination of the size and from parameters until you reach the total. Passing an empty field parameter returns only the index you are interested in and _id.
Find a good page size that you can use without running out of memory, and increment from each iteration.
curl -X GET 'http://localhost:9200/documents/document/_search?fields=&size=1000&from=5000'
Response to the request element:
{ "_index" : "documents", "_type" : "document", "_id" : "1341", "_score" : 1.0 }, ...
source share