Skip to content

Use HTTP POST for elasticsearch.scroll(). #974

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
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions elasticsearch/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1296,8 +1296,8 @@ def explain(self, index, id, doc_type="_doc", body=None, params=None):
"GET", _make_path(index, doc_type, id, "_explain"), params=params, body=body
)

@query_params("scroll", "rest_total_hits_as_int", "scroll_id")
def scroll(self, body=None, params=None):
@query_params("rest_total_hits_as_int")
def scroll(self, scroll=None, scroll_id=None, body=None, params=None):
"""
Scroll a search request created by specifying the scroll parameter.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html>`_
Expand All @@ -1311,8 +1311,20 @@ def scroll(self, body=None, params=None):
are in multiple versions (7.0 and 6.latest)
"""

if scroll in SKIP_IN_PATH and body in SKIP_IN_PATH or \
scroll_id in SKIP_IN_PATH and body in SKIP_IN_PATH:
raise ValueError("You need to supply (scroll and scroll_id) or body.")

if body:
if scroll:
params["scroll"] = scroll
if scroll_id:
params["scroll_id"] = scroll_id
else:
body = {"scroll": scroll, "scroll_id": scroll_id}

return self.transport.perform_request(
"GET", "/_search/scroll", params=params, body=body
"POST", "/_search/scroll", params=params, body=body
)

@query_params()
Expand Down