- 最新
- 投票最多
- 评论最多
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.
相关内容
- AWS 官方已更新 2 年前
- AWS 官方已更新 1 年前
- AWS 官方已更新 2 年前