Executing a scrolling query
Every time a query is executed, the results are calculated and returned to the user in real time. In Elasticsearch, there is no deterministic order for records—pagination on a big block of values can lead to inconsistency between results. This is due to added and deleted documents and also documents that have the same score.
The scrolling query tries to resolve this kind of problem by giving a special cursor that allows the user to uniquely iterate all of the documents.Â
Getting ready
You will need an up-and-running Elasticsearch installation, as described in the Downloading and installing Elasticsearch recipe of Chapter 1, Getting Started.
To execute these commands, any HTTP client can be used, such as Curl (https://curl.haxx.se/), Postman (https://www.getpostman.com/), or similar. I suggest using the Kibana console as it provides code completion and better character escaping for Elasticsearch.
To correctly execute...