Skip to content

Commit

Permalink
Define body for scroll queries
Browse files Browse the repository at this point in the history
Closes #221
  • Loading branch information
danielmitterdorfer committed Feb 9, 2017
1 parent 7b61ea2 commit e1ecd34
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions esrally/driver/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,6 @@ def scroll_query(self, es, params):
scroll="10s",
size=params["items_per_page"],
request_cache=params["use_request_cache"])

if "_scroll_id" in r:
self.scroll_id = r["_scroll_id"]
else:
Expand All @@ -390,12 +389,16 @@ def scroll_query(self, es, params):
if hit_count == 0:
# We're done prematurely. Even if we are on page index zero, we still made one call.
return page + 1, "ops"
r = es.scroll(scroll_id=self.scroll_id, scroll="10s")
r = es.scroll(body={"scroll_id": self.scroll_id, "scroll": "10s"})
return total_pages, "ops"

def __exit__(self, exc_type, exc_val, exc_tb):
if self.scroll_id and self.es:
self.es.clear_scroll(scroll_id=self.scroll_id)
try:
self.es.clear_scroll(body={"scroll_id": [self.scroll_id]})
except BaseException:
logger.exception("Could not clear scroll. This will lead to excessive resource usage in Elasticsearch and "
"will skew your benchmark results.")
self.scroll_id = None
self.es = None
return False
Expand Down

0 comments on commit e1ecd34

Please sign in to comment.