Skip to content

Latest commit

 

History

History
46 lines (37 loc) · 2.39 KB

documentation.md

File metadata and controls

46 lines (37 loc) · 2.39 KB

Documentation

Pagination

Pagination is supported via the offset operator and the search_after operator.

offset

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

search_after

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:

  1. Any query using the search_after operator must also include the order_by clause
  2. The order of elements in search_after should be identical to the order of corresponding fields in order_by. For example, consider a model that has got the fields email and customerId and you want to sort by both. The correct values would be
order_by: [
  {customerId: Asc}, 
  {email: Asc}
], 
args: {
  searchAfter: [
    "cust005", 
    "[email protected]"
  ]
}

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
    "[email protected]",
    "cust005", 
  ]
}

/query/explain

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.