Pagination is supported via the offset operator and the search_after operator.
The offset operator can be used if the sum of page size (limit) and the offset value is less than or equal to the value of index.max_result_window (defaults to 10,000). This is a restriction imposed by Elasticsearch. For paginating further, please use the search_after operator
The search_after operator can be used to page more than index.max_result_window (default: 10,000) results. The search_after operator exposed in GraphQL queries is functionally and syntactically similar to the search_after operator in the Elasticsearch. It expects an array of sort values as its argument (read more about search_after in Elasticsearch).
Please note the following requirements for correctly using the search_after operator:
- Any query using the
search_afteroperator must also include theorder_byclause - The order of elements in
search_aftershould be identical to the order of corresponding fields inorder_by. For example, consider a model that has got the fieldsemailandcustomerIdand you want to sort by both. The correct values would be
order_by: [
{customerId: Asc},
{email: Asc}
],
args: {
searchAfter: [
"cust005",
"cust_5@abc.xyz"
]
}and, the incorrect way would be
order_by: [
{customerId: Asc},
{email: Asc}
],
args: {
searchAfter: [ // the order of elements is not the same as the order of fields in order_by
"cust_5@abc.xyz",
"cust005",
]
}NDC Elasticsearch supports the /query/explain endpoint from the NDC Spec using Elasticsearch's Search Profile API. Elasticsearch's Search Explain API is not used because it requires a document ID, which is not avaialble at the time of query.