Skip to content

[FEATURE] Add dedicated page size setting for serverless mode (search_after pagination) #694

Description

@lawofcycles

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?

  1. Reuse opensearch.scroll.size with a higher default when serverless mode is enabled. Simpler but semantically confusing.
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions