Skip to content

Automatically close scroll context when returning streamed results #1745

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

Closed
sothawo opened this issue Mar 27, 2021 · 0 comments · Fixed by #1746
Closed

Automatically close scroll context when returning streamed results #1745

sothawo opened this issue Mar 27, 2021 · 0 comments · Fixed by #1746
Assignees
Labels
type: enhancement A general enhancement

Comments

@sothawo
Copy link
Collaborator

sothawo commented Mar 27, 2021

When using SearchOperations#searchForStream(Query, Class<T>) - and this is used when a repository method is defined to return a Stream<T> - currently it is necessary to call the close() method of the iterator/stream to delete the associated scroll context from Elasticsearch. If this is not done, the scroll context will automatically timeout after 60 seconds, but if many stream are created, then the limit of 500 scroll contexts in Elasticsearch may be reached.

As the implementation knows when all documents are processed, we should call close() automatically when the iterator has no more records so that an explicit closing is not necessary.

@sothawo sothawo added the type: enhancement A general enhancement label Mar 27, 2021
@sothawo sothawo self-assigned this Mar 27, 2021
This was referenced Mar 27, 2021
sothawo added a commit that referenced this issue Mar 27, 2021
@sothawo sothawo added this to the 4.2 RC1 (2021.0.0) milestone Mar 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant