Skip to content

Fix the calculation of the requested number of documents. #3128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 15, 2025

Conversation

sothawo
Copy link
Collaborator

@sothawo sothawo commented Jul 12, 2025

This PR changes the calculation of the requestSize (number of documents requested from Elasticsearch for a Query, depending on the values of a Pageable on the reuqest and a maxResults value:

  • the user has set a page size
    • no maxResults are set -> requestSize = pageSize
    • maxResults are set -> requestSize = min(pageSize, maxResults)
  • the user did not set any Pageable on the query
    • maxResults are set -> requestSize = maxResults
    • maxResults are not set -> requestSize = DEFAULT_PAGE_SIZE (10)
  • the user explicitly set a Pageable.unpaged() on the query
    • maxResults are not set -> requestSize = INDEX_MAX_RESULT_WINDOW (10000)
    • maxResults are set -> requestSize = min(INDEX_MAX_RESULT_WINDOW, maxResults)

Closes #3127

@sothawo sothawo self-assigned this Jul 12, 2025
@sothawo sothawo force-pushed the gh3127_fix-request-paging branch from bb2edce to 324b619 Compare July 14, 2025 19:00
Signed-off-by: Peter-Josef Meisch <pj.meisch@sothawo.com>
@sothawo sothawo force-pushed the gh3127_fix-request-paging branch from 324b619 to 7617f9d Compare July 15, 2025 16:27
@sothawo sothawo merged commit 12ddb74 into spring-projects:main Jul 15, 2025
1 check passed
@sothawo sothawo deleted the gh3127_fix-request-paging branch July 15, 2025 16:29
sothawo added a commit that referenced this pull request Jul 15, 2025
Original Pull Request #3128
Closes #3127

Signed-off-by: Peter-Josef Meisch <pj.meisch@sothawo.com>
(cherry picked from commit 12ddb74)
sothawo added a commit that referenced this pull request Jul 15, 2025
Original Pull Request #3128
Closes #3127

Signed-off-by: Peter-Josef Meisch <pj.meisch@sothawo.com>
(cherry picked from commit 12ddb74)
(cherry picked from commit 786e092)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix value of request size sent to Elasticsearch when no Pageable is defined in a query
1 participant