3 ms·
I've worked with APIs (mainly based on ElasticSearch backends) that implement something like this pattern. There, the "cursor" is called a "ScrollId." Here's w
by Centigonal 6y ago
I've worked with APIs (mainly based on ElasticSearch backends) that implement something like this pattern. There, the "cursor" is called a "ScrollId."
Here's what that looks like in ES: https://www.elastic.co/guide/en/elasticsearch/client/java-rest/master/java-rest-high-search-scroll.html https://www.elastic.co/guide/en/elasticsearch/client/java-re...
The APIs I generally work will abstract away most of the scroll context configuration stuff, and just return a page of results, plus the ScrollId for the next page.
- blueline 6y agoElastic search now recommends using “search_after” instead of scrolling for deep pagination, although mechanically they’re pretty similar to use
- Centigonal 6y agoThanks for the heads-up!
- dmitryminkovsky 6y agoElasticsearch’s search_after is a pleasure to use. So easy especially with nullable fields, where the equivalent SQL can get really, really messy with just a few columns.
- Andys 6y agoYeah - search_after is the stateless version
- Andys 6y agoAlso, they have a concurrent version called "Sliced Scroll" which lets you do multi-threaded fetch in N streams, each with their own cursor.