From 5fe3b4baf8c3e28529fe9bfcd311256f15f70dfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Kr=C3=A1l?= Date: Wed, 2 Nov 2016 19:29:41 +0100 Subject: [PATCH] Scan bug that caused the scan to be sorted --- elasticsearch/helpers/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elasticsearch/helpers/__init__.py b/elasticsearch/helpers/__init__.py index 3cd8e224..953b644f 100644 --- a/elasticsearch/helpers/__init__.py +++ b/elasticsearch/helpers/__init__.py @@ -276,8 +276,8 @@ def scan(client, query=None, scroll='5m', raise_on_error=True, """ if not preserve_order: - body = query.copy() if query else {} - body["sort"] = "_doc" + query = query.copy() if query else {} + query["sort"] = "_doc" # initial search resp = client.search(body=query, scroll=scroll, size=size, request_timeout=request_timeout, **kwargs)