Is your feature request related to a problem?
In serverless mode, pagination uses PIT + search_after instead of the Scroll API (#586). However, the page size is currently controlled by opensearch.scroll.size (default: 1000), which is semantically misleading since no scrolling is involved. This also means the default is suboptimal for serverless, where reducing the number of round trips matters more due to higher network latency.
What solution would you like?
Introduce a dedicated setting such as opensearch.search_after.size (or opensearch.serverless.page.size) for controlling the page size in serverless mode. In serverless mode, this setting would be used instead of opensearch.scroll.size.
A higher default (e.g. 10,000) would be appropriate for serverless, as it reduces the number of requests significantly (e.g. 100,000 documents: 100 requests at 1,000 vs 10 requests at 10,000). The maximum value is bounded by index.max_result_window (default 10,000) on the OpenSearch side.
What alternatives have you considered?
- Reuse
opensearch.scroll.size with a higher default when serverless mode is enabled. Simpler but semantically confusing.
- Keep the current behavior and document that users should increase
opensearch.scroll.size for serverless. No code change needed but poor discoverability.
Do you have any additional context?
This is part of a broader effort to cleanly separate scroll-based and search_after-based pagination, as noted in the future considerations section of #586. The RestRepository.delete() path also hardcodes a batch size of 500, which could benefit from the same dedicated setting.
Is your feature request related to a problem?
In serverless mode, pagination uses PIT + search_after instead of the Scroll API (#586). However, the page size is currently controlled by
opensearch.scroll.size(default: 1000), which is semantically misleading since no scrolling is involved. This also means the default is suboptimal for serverless, where reducing the number of round trips matters more due to higher network latency.What solution would you like?
Introduce a dedicated setting such as
opensearch.search_after.size(oropensearch.serverless.page.size) for controlling the page size in serverless mode. In serverless mode, this setting would be used instead ofopensearch.scroll.size.A higher default (e.g. 10,000) would be appropriate for serverless, as it reduces the number of requests significantly (e.g. 100,000 documents: 100 requests at 1,000 vs 10 requests at 10,000). The maximum value is bounded by
index.max_result_window(default 10,000) on the OpenSearch side.What alternatives have you considered?
opensearch.scroll.sizewith a higher default when serverless mode is enabled. Simpler but semantically confusing.opensearch.scroll.sizefor serverless. No code change needed but poor discoverability.Do you have any additional context?
This is part of a broader effort to cleanly separate scroll-based and search_after-based pagination, as noted in the future considerations section of #586. The
RestRepository.delete()path also hardcodes a batch size of 500, which could benefit from the same dedicated setting.