# Scan and Scroll in Elastic Search 2.4

**URL:** <https://discuss.elastic.co/t/scan-and-scroll-in-elastic-search-2-4/99017>\
**Category:** Elasticsearch\
**Created:** [August 31, 2017, 2:28pm UTC](https://discuss.elastic.co/t/scan-and-scroll-in-elastic-search-2-4/99017 "2017-08-31T14:28:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sss](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sss/32/31486_2.png) [@sss](https://discuss.elastic.co/u/sss)\
**Post date:** [August 31, 2017, 2:28pm UTC](https://discuss.elastic.co/t/scan-and-scroll-in-elastic-search-2-4/99017/1 "2017-08-31T14:28:10Z")

</div>

We are using Elastic Search 2.4. we use the java client to invoke scan and scroll api to scan through large num of docs..However, i dont see a performance boost as much as it is expected of scan and scroll api...I just wanted to check if my configurations require any more optimizations.

This is how i am doing scan

client().prepareSearch(content.getIndexName())  
.setQuery("match\_all\_query")).setSearchType(SearchType.QUERY\_AND\_FETCH)  
.setScroll(new TimeValue(15000)).setSize(size);

and this is how i am using scroll

client().prepareSearchScroll(scrollID).setScroll(new TimeValue(15000)).execute().actionGet();

I see that in ES 2.4, Using Searchtype.SCAN is deprecated. And i am also aware that scan api doesnt perform any sorting by default....

1. Is it the same case with QUERY\_AND\_FETCH or do we have to explicitly specify the sort order to not sort the results

2. also, do we have a limit on the number of results returned by SCAN/QUERY\_AND\_FETCH

3. Do we have any standard optimal configuration which ElasticSearch recommends, given that my usecase is just to scan through all the docs stored in index and delete them conditionally

---

<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:** [September 28, 2017, 2:28pm UTC](https://discuss.elastic.co/t/scan-and-scroll-in-elastic-search-2-4/99017/2 "2017-09-28T14:28:23Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
