Skip to content

Commit

Permalink
Remove OpenSearchRequestBuilder.buildRequestWithScroll
Browse files Browse the repository at this point in the history
Signed-off-by: Tomoyuki Morita <moritato@amazon.com>
  • Loading branch information
ykmr1224 committed Feb 25, 2025
1 parent 9ea3f54 commit ca18a9b
Showing 1 changed file with 0 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,32 +132,6 @@ private OpenSearchRequest buildRequestWithPit(
}
}

private OpenSearchRequest buildRequestWithScroll(
OpenSearchRequest.IndexName indexName, int maxResultWindow, TimeValue cursorKeepAlive) {
int size = requestedTotalSize;
FetchSourceContext fetchSource = this.sourceBuilder.fetchSource();
List<String> includes = fetchSource != null ? Arrays.asList(fetchSource.includes()) : List.of();

if (pageSize == null) {
if (startFrom + size > maxResultWindow) {
sourceBuilder.size(maxResultWindow - startFrom);
return new OpenSearchScrollRequest(
indexName, cursorKeepAlive, sourceBuilder, exprValueFactory, includes);
} else {
sourceBuilder.from(startFrom);
sourceBuilder.size(requestedTotalSize);
return new OpenSearchQueryRequest(indexName, sourceBuilder, exprValueFactory, includes);
}
} else {
if (startFrom != 0) {
throw new UnsupportedOperationException("Non-zero offset is not supported with pagination");
}
sourceBuilder.size(pageSize);
return new OpenSearchScrollRequest(
indexName, cursorKeepAlive, sourceBuilder, exprValueFactory, includes);
}
}

private String createPit(
OpenSearchRequest.IndexName indexName, TimeValue cursorKeepAlive, OpenSearchClient client) {
// Create PIT ID for request
Expand Down

0 comments on commit ca18a9b

Please sign in to comment.