Use PIT + search_after for delete in serverless mode (#691) - #693
Merged
harshavamsi merged 3 commits intoFeb 20, 2026
Merged
Conversation
lawofcycles
requested review from
Xtansia,
harshavamsi and
nknize
as code owners
February 20, 2026 18:57
…ect#691) Signed-off-by: Sotaro Hikita <bering1814@gmail.com>
lawofcycles
force-pushed
the
fix/serverless-delete-search-after
branch
from
February 20, 2026 19:01
9060ca7 to
ba7c996
Compare
Signed-off-by: Sotaro Hikita <bering1814@gmail.com>
Collaborator
Author
|
Note: The Gradle Precommit CI job is expected to fail due to a dependency license SHA mismatch, which is unrelated to this PR and will be resolved by #688. |
Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
RestRepository.delete()uses the Scroll API to iterate all documents for bulk deletion, which is called when Spark'sSaveMode.Overwriteis used. The Scroll API is not supported on OpenSearch Serverless, so overwrite operations fail when the existing document count exceeds the internal batch size (500).With fewer than 500 documents, the overwrite happens to succeed because all documents are returned in the initial search response and no scroll continuation is needed. With more than 500 documents, the scroll continuation call (
POST _search/scroll) returns 404.This change branches the delete logic so that serverless mode uses PIT + search_after pagination (via
scanLimitSearchAfter) to iterate all documents for deletion, consistent with the read path implemented in #586.Verified on EMR 7.12 + OpenSearch Serverless with 600 documents (exceeding the 500 batch size).
Issues Resolved
Fixes #691
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.