What is the best way to scan through my search results?
Search results are paginated. By default, 100 results are returned per page, configurable via the per_page
parameter. In order to request from one page to the next, a page index is specified in the search_option
. The default value is 1, referring to the first page. If you want to look at the fourth page, set page
to 4:
{
"filter": {
"state": {
"type": "eq",
"value": "CA"
}
},
"page": 4
}
Metadata about the entire result set is in the info
field of the response. The total_result_count
field represents the total document count, and the num_pages
field represents the total number of pages.
For example:
"info": {
"current_page": 1,
"num_pages": 11,
"per_page": 200,
"total_result_count": 2056
}
A common practice is to also define an order for the items in the result set to ensure the items are returned in a consistent and deterministic manner. This is accomplished by setting the sort
field in your search_option
:
{
"filter": {
"state": {
"type": "eq",
"value": "CA"
}
},
{
"sort": [
{
"id": "asc",
}
]
},
"page": 4
}