# For exporting data shoud we use scroll or pit with search after?

**URL:** <https://discuss.elastic.co/t/for-exporting-data-shoud-we-use-scroll-or-pit-with-search-after/314475>\
**Category:** Elasticsearch\
**Created:** [September 15, 2022, 5:05am UTC](https://discuss.elastic.co/t/for-exporting-data-shoud-we-use-scroll-or-pit-with-search-after/314475 "2022-09-15T05:05:45Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Divit\_Sharma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divit_sharma/32/32348_2.png) [@Divit\_Sharma](https://discuss.elastic.co/u/Divit_Sharma)\
**Post date:** [September 20, 2022, 7:17pm UTC](https://discuss.elastic.co/t/for-exporting-data-shoud-we-use-scroll-or-pit-with-search-after/314475/3 "2022-09-20T19:17:22Z")

</div>

@dadoonet Sorry for tagging you but I just wanted to confirm this. I found your reply to below saying that `_scroll` is preferred over `search_after` for pulling whole dataset. Does it still apply ?  
The documentation has not mentioned this clearly.

> [@Recommendation to use search after instead of scrolling](https://discuss.elastic.co/t/recommendation-to-use-search-after-instead-of-scrolling/268293):
>
> Hello everybody If you want to read an index completely, you can read in the documentation that the search after function should be used from 10,000 documents (instead of scroll). We have now tested this and unfortunately we have noticed a slowdown by a factor of 10. we sort with the \_id meta field. If we use a technical id as a number for sorting, the speed is the same as when scrolling. unfortunately we do not have a technical number field in our use case. why is sorting with a text field …

It still makes sense to me to use `_scroll` since for `search_after` I still need to move through the hits to find the sort value in the last document whereas in `_scroll` I just use the `scroll_id` for the next batch.

---

_[View the full topic](https://discuss.elastic.co/t/for-exporting-data-shoud-we-use-scroll-or-pit-with-search-after/314475)._
