Cloudant _find invalid_bookmark Error During Pagination After Index Rebuild
0 reputation · 21 Jul 2021, 17:05 UTC
Cloudant _find invalid_bookmark Error During Pagination After Index Rebuild
Goal: paginate a large Cloudant dataset using the _find endpoint with bookmark-based keyset pagination while bounding each page to the documented maximum of 2000 documents.
Constraint: a bookmark is valid only for the current index version and can become invalid after index rebuilds or compaction. Reusing a stale bookmark returns a 400 error with reason invalid_bookmark. Cloudant also provides no built-in snapshot guarantee across pages, so concurrent writes may produce missing or duplicate documents between requests.
Uncertainty: whether an application should treat invalid_bookmark as a fatal pagination failure, restart from the beginning of the index, or attempt to resume from the last successfully returned document, and how to detect index rebuild events that invalidate outstanding bookmarks.
- Does Cloudant surface index version or rebuild metadata that applications can use to detect bookmark invalidation before requesting the next page?
- Should pagination logic restart from the first document after an invalid_bookmark error, or is there a supported resume strategy using the last returned document's sort values?
- What consistency level can be expected when paginating a large dataset under concurrent writes without the stable parameter?