# Python library: search over large dataset sorted by timestamp

**URL:** <https://discuss.elastic.co/t/python-library-search-over-large-dataset-sorted-by-timestamp/15891>\
**Category:** Elasticsearch\
**Created:** [February 19, 2014, 10:01am UTC](https://discuss.elastic.co/t/python-library-search-over-large-dataset-sorted-by-timestamp/15891 "2014-02-19T10:01:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew\_Vine](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrew_vine/32/1778_2.png) [@Andrew\_Vine](https://discuss.elastic.co/u/Andrew_Vine)\
**Post date:** [February 19, 2014, 10:01am UTC](https://discuss.elastic.co/t/python-library-search-over-large-dataset-sorted-by-timestamp/15891/1 "2014-02-19T10:01:39Z")

</div>

Hi all,

I would like to read over all the docs for an index in timestamp order.

Does anyone have a suggestion as to what would be the best way to do this  
using the python client?

At the moment I'm using the search[http://elasticsearch-py.readthedocs.org/en/latest/api.html](http://elasticsearch-py.readthedocs.org/en/latest/api.html) function  
provided. From reading the api docs I should benefit by using the scroll  
option however the docs on the python client api are unclear  
as to how you use the scroll on repeated searches.

Regards  
Andrew

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/b65c7e23-cd53-4a17-a7aa-597520ca473a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b65c7e23-cd53-4a17-a7aa-597520ca473a%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Honza\_Kral](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/honza_kral/32/876_2.png) [@Honza\_Kral](https://discuss.elastic.co/u/Honza_Kral)\
**Post date:** [February 19, 2014, 11:39am UTC](https://discuss.elastic.co/t/python-library-search-over-large-dataset-sorted-by-timestamp/15891/2 "2014-02-19T11:39:36Z")

</div>

Hi Andrews,

there is a helper function that will help you with the repeated  
searches (do them for you) in the helpers module (0).

Unfortunately scroll/scan combination doesn't support sorting since it  
would be very expensive to do. If you need the results sorted you have  
to use normal search method and do the pagination yourself.

Hope this helps,

Honza

0 - [Helpers — Python Elasticsearch client 8.11.0 documentation](http://elasticsearch-py.readthedocs.org/en/latest/helpers.html#elasticsearch.helpers.scan)

On Wed, Feb 19, 2014 at 11:01 AM, Andrew Vine [andrew.vine@gmail.com](mailto:andrew.vine@gmail.com) wrote:

> Hi all,
> 
> I would like to read over all the docs for an index in timestamp order.
> 
> Does anyone have a suggestion as to what would be the best way to do this  
> using the python client?
> 
> At the moment I'm using the search function provided. From reading the api  
> docs I should benefit by using the scroll option however the docs on the  
> python client api are unclear  
> as to how you use the scroll on repeated searches.
> 
> Regards  
> Andrew
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/b65c7e23-cd53-4a17-a7aa-597520ca473a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b65c7e23-cd53-4a17-a7aa-597520ca473a%40googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CABfdDirhGHvGiWRpHjPd5TS3438qpgr6OaSxD5pfK3g-XFgVtQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CABfdDirhGHvGiWRpHjPd5TS3438qpgr6OaSxD5pfK3g-XFgVtQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Andrew\_Vine](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrew_vine/32/1778_2.png) [@Andrew\_Vine](https://discuss.elastic.co/u/Andrew_Vine)\
**Post date:** [February 19, 2014, 3:34pm UTC](https://discuss.elastic.co/t/python-library-search-over-large-dataset-sorted-by-timestamp/15891/3 "2014-02-19T15:34:15Z")

</div>

Thanks, I ended up doing repeated range queries by my timestamp field.

On Wed, Feb 19, 2014 at 1:39 PM, Honza Král [honza.kral@elasticsearch.com](mailto:honza.kral@elasticsearch.com)wrote:

> Hi Andrews,
> 
> there is a helper function that will help you with the repeated  
> searches (do them for you) in the helpers module (0).
> 
> Unfortunately scroll/scan combination doesn't support sorting since it  
> would be very expensive to do. If you need the results sorted you have  
> to use normal search method and do the pagination yourself.
> 
> Hope this helps,
> 
> Honza
> 
> 0 -  
> [Helpers — Python Elasticsearch client 8.11.0 documentation](http://elasticsearch-py.readthedocs.org/en/latest/helpers.html#elasticsearch.helpers.scan)
> 
> On Wed, Feb 19, 2014 at 11:01 AM, Andrew Vine [andrew.vine@gmail.com](mailto:andrew.vine@gmail.com)  
> wrote:
> 
> > Hi all,
> > 
> > I would like to read over all the docs for an index in timestamp order.
> > 
> > Does anyone have a suggestion as to what would be the best way to do this  
> > using the python client?
> > 
> > At the moment I'm using the search function provided. From reading the  
> > api  
> > docs I should benefit by using the scroll option however the docs on the  
> > python client api are unclear  
> > as to how you use the scroll on repeated searches.
> > 
> > Regards  
> > Andrew
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit
> 
> [https://groups.google.com/d/msgid/elasticsearch/b65c7e23-cd53-4a17-a7aa-597520ca473a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b65c7e23-cd53-4a17-a7aa-597520ca473a%40googlegroups.com)  
> .
> 
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/ifVeqydS2Rc/unsubscribe](https://groups.google.com/d/topic/elasticsearch/ifVeqydS2Rc/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CABfdDirhGHvGiWRpHjPd5TS3438qpgr6OaSxD5pfK3g-XFgVtQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CABfdDirhGHvGiWRpHjPd5TS3438qpgr6OaSxD5pfK3g-XFgVtQ%40mail.gmail.com)  
> .  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAE6AM-gHyL5cN0mfFVVh2-A0Z6aiYiHr5RsQBysN9a2NY%2BFSTA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAE6AM-gHyL5cN0mfFVVh2-A0Z6aiYiHr5RsQBysN9a2NY%2BFSTA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:49am UTC](https://discuss.elastic.co/t/python-library-search-over-large-dataset-sorted-by-timestamp/15891/4 "2017-07-06T01:49:01Z")

</div>


