Concept Flow - Pagination (from/size)
Start Query
Set 'from' Offset
Set 'size' Limit
Execute Search
Return Results Slice
End
The query sets a starting point ('from') and number of results ('size'), then returns that slice of search results.
{
"from": 10,
"size": 5,
"query": { "match_all": {} }
}| Step | Action | Value of 'from' | Value of 'size' | Results Returned |
|---|---|---|---|---|
| 1 | Start query execution | 0 (default) | 10 (default) | First 10 results |
| 2 | Set 'from' to 10 | 10 | 10 (default) | Skip first 10 results |
| 3 | Set 'size' to 5 | 10 | 5 | Return 5 results starting at 11th |
| 4 | Execute search | 10 | 5 | Results 11 to 15 returned |
| 5 | End | 10 | 5 | Pagination complete |
| Variable | Start | After Step 2 | After Step 3 | Final |
|---|---|---|---|---|
| from | 0 (default) | 10 | 10 | 10 |
| size | 10 (default) | 10 | 5 | 5 |
Pagination in Elasticsearch uses 'from' and 'size'. 'from' skips that many results. 'size' limits how many results to return. Defaults: from=0, size=10. Together they slice the result set for paging.