- Newest
- Most votes
- Most comments
AppSync can use either cursor-based or offset-based pagination. At AppSync, we generally lean toward cursor-based pagination as it's more ideal for real-time data where the ordering of records might change. (Useful explanation of advantages / disadvantages of Cursor-Based over Offset-based pagination: https://www.sitepoint.com/paginating-real-time-data-cursor-based-pagination/) It sounds like in your use case, you'll want to simply use offset-based pagination, which can be accomplished using the size and from attributes in the elasticsearch query, as you mentioned. You can pass size and from args from your graphql query into your elasticsearch query.
Aaron,
Thanks for the reply. I did go with the offset style as that just made more sense. I will need to look at that url you posted to have a better understanding of the pros/cons of each.
Following up to this. You can use the Elasticsearch Search After APIs to implement cursor based pagination on data in Elasticsearch. See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-body.html#request-body-search-search-after for more information.
Relevant content
- asked 5 years ago
- asked 4 years ago
- Accepted Answerasked a year ago
- AWS OFFICIALUpdated a month ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago