From 756298a36021ef24529115f01df6e8a4bce1567a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Kr=C3=A1l?= Date: Thu, 12 Feb 2015 10:58:20 +0100 Subject: [PATCH] Added documentation explaining scan and ordering Thanks drorata for the initial patch and issue --- elasticsearch/helpers/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/elasticsearch/helpers/__init__.py b/elasticsearch/helpers/__init__.py index cff3795c..5a831f90 100644 --- a/elasticsearch/helpers/__init__.py +++ b/elasticsearch/helpers/__init__.py @@ -193,6 +193,12 @@ def scan(client, query=None, scroll='5m', preserve_order=False, **kwargs): :meth:`~elasticsearch.Elasticsearch.scroll` api - a simple iterator that yields all hits as returned by underlining scroll requests. + By default scan does not return results in any pre-determined order. To + have a standard order in the returned documents (either by score or + explicit sort definition) when scrolling, use ``preserve_order=True``. This + may be an expensive operation and will negate the performance benefits of + using ``scan``. + :arg client: instance of :class:`~elasticsearch.Elasticsearch` to use :arg query: body for the :meth:`~elasticsearch.Elasticsearch.search` api :arg scroll: Specify how long a consistent view of the index should be