July 2015
Intermediate to advanced
192 pages
3h 38m
English
While searching, users can't view all the results at once. They like to see one batch at a time. Usually, a single batch contains 10 matched documents, as in Google search results, where each page contains 10 search results. This also gives us an advantage over the search engine as it need not send all the results back at once. The following is how we use pagination in Elasticsearch. Let's say that we are interested in seeing only five results at a time, then to get the first page, we have to use the following parameters:
size = 5 (defaults to 10).from = 0, 5, 10, 15, 20 (defaults to 0). This depends on the page number you need.Also, it should be noted that the total number of pages can be calculated from count/_size. Sample query for ...
Read now
Unlock full access