Allow the use of scroll_id

Reverts breaking change in 8e92b85
This commit is contained in:
Honza Král
2019-08-21 15:58:27 +02:00
parent 28920b5d59
commit a98fa8ba9f
+8 -2
View File
@@ -1296,8 +1296,8 @@ class Elasticsearch(object):
"GET", _make_path(index, doc_type, id, "_explain"), params=params, body=body "GET", _make_path(index, doc_type, id, "_explain"), params=params, body=body
) )
@query_params("scroll", "rest_total_hits_as_int", "scroll_id") @query_params("scroll", "rest_total_hits_as_int")
def scroll(self, body=None, params=None): def scroll(self, body=None, scroll_id=None, params=None):
""" """
Scroll a search request created by specifying the scroll parameter. Scroll a search request created by specifying the scroll parameter.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html>`_ `<http://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html>`_
@@ -1310,6 +1310,12 @@ class Elasticsearch(object):
in the response. This param is added version 6.x to handle mixed cluster queries where nodes in the response. This param is added version 6.x to handle mixed cluster queries where nodes
are in multiple versions (7.0 and 6.latest) are in multiple versions (7.0 and 6.latest)
""" """
if scroll_id in SKIP_IN_PATH and body in SKIP_IN_PATH:
raise ValueError("You need to supply scroll_id or body.")
elif scroll_id and not body:
body = {"scroll_id": [scroll_id]}
elif scroll_id:
params["scroll_id"] = scroll_id
return self.transport.perform_request( return self.transport.perform_request(
"GET", "/_search/scroll", params=params, body=body "GET", "/_search/scroll", params=params, body=body