# \_search/scroll?search\_type=scan bugs/inconsistencies

**URL:** <https://discuss.elastic.co/t/-search-scroll-search-type-scan-bugs-inconsistencies/17652>\
**Category:** Elasticsearch\
**Created:** [May 21, 2014, 6:20pm UTC](https://discuss.elastic.co/t/-search-scroll-search-type-scan-bugs-inconsistencies/17652 "2014-05-21T18:20:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![schmichael](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@schmichael](https://discuss.elastic.co/u/schmichael)\
**Post date:** [May 21, 2014, 6:20pm UTC](https://discuss.elastic.co/t/-search-scroll-search-type-scan-bugs-inconsistencies/17652/1 "2014-05-21T18:20:53Z")

</div>

I use scrolling to page through large sets of documents and noticed  
recently I hadn't set search\_type=scan when I don't need sorting.

Once I enabled search\_type=scan I noticed two inconsistencies compared  
against the default search\_type:

1. search\_type=scan doesn't return any results when starting to scroll  
while the default search\_type returns the first page of results. (The docs  
seem to warn this happens, but it seems like a strange inconsistency within  
the scroll API).
2. search\_type=scan doesn't seem to honor size=N

The second one is a much bigger deal as I have an API backed by an ES  
scroll where users can specify the page size they want.

You should be able to fully reproduce what I'm seeing using this:

> <https://gist.github.com/schmichael/5c3ff512359262970d16>

Do I need to use from=... with size=...? I didn't have to before switching  
to search\_type=scan.

I'm using ES 1.1.1 on Ubuntu using the deb provided by ES.org.

--  
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/9f0d0560-a5bb-4ca0-8483-e6038291c780%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9f0d0560-a5bb-4ca0-8483-e6038291c780%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![schmichael](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@schmichael](https://discuss.elastic.co/u/schmichael)\
**Post date:** [May 21, 2014, 6:28pm UTC](https://discuss.elastic.co/t/-search-scroll-search-type-scan-bugs-inconsistencies/17652/2 "2014-05-21T18:28:17Z")

</div>

On Wednesday, May 21, 2014 11:20:53 AM UTC-7, schmichael wrote:

> ...  
> 2. search\_type=scan doesn't seem to honor size=N

It seems I missed this in the guide:

"When scanning, the size is applied to each shard, so you will get back a  
maximum of size \* number\_of\_primary\_shards documents in each batch."

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

...but that only seems to be the case with the scan search\_type. Do I just  
have to divide the user's requested page size by my number of shards (5 at  
this point)?

--  
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/76d3e1eb-f0dd-46f3-a508-7b246b068e21%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/76d3e1eb-f0dd-46f3-a508-7b246b068e21%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [May 23, 2014, 12:09am UTC](https://discuss.elastic.co/t/-search-scroll-search-type-scan-bugs-inconsistencies/17652/3 "2014-05-23T00:09:56Z")

</div>

scan is mainly useful as a way to export data from the index. In the  
context of a user interface, I think scroll would make more sense[1]. On a  
side note, paging improved significantly for scroll requests in  
Elasticsearch 1.2 (in both terms of speed and memory usage).

[1]

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

On Wed, May 21, 2014 at 8:28 PM, schmichael [michael@lytics.io](mailto:michael@lytics.io) wrote:

> On Wednesday, May 21, 2014 11:20:53 AM UTC-7, schmichael wrote:
> 
> > ...  
> > 2. search\_type=scan doesn't seem to honor size=N
> 
> It seems I missed this in the guide:
> 
> "When scanning, the size is applied to each shard, so you will get back a  
> maximum of size \* number\_of\_primary\_shards documents in each batch."
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/scan-scroll.html)
> 
> ...but that only seems to be the case with the scan search\_type. Do I just  
> have to divide the user's requested page size by my number of shards (5 at  
> this point)?
> 
> --  
> 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/76d3e1eb-f0dd-46f3-a508-7b246b068e21%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/76d3e1eb-f0dd-46f3-a508-7b246b068e21%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/76d3e1eb-f0dd-46f3-a508-7b246b068e21%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/76d3e1eb-f0dd-46f3-a508-7b246b068e21%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Adrien Grand

--  
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/CAL6Z4j74g0Qqz0VLNDAHDEZ9N%3D2w723vEWaxqicfnQ\_Cn1DSfA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74g0Qqz0VLNDAHDEZ9N%3D2w723vEWaxqicfnQ_Cn1DSfA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![schmichael](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@schmichael](https://discuss.elastic.co/u/schmichael)\
**Post date:** [May 23, 2014, 12:17am UTC](https://discuss.elastic.co/t/-search-scroll-search-type-scan-bugs-inconsistencies/17652/4 "2014-05-23T00:17:22Z")

</div>

Thanks for the response Adrien. I'm excited to upgrade to 1.2, but it seems  
strange to me that people refer to scan vs. scroll (you're not the first)  
as scan is simply a search\_type that - AFAIK - can be used for any type of  
search (scroll or otherwise).

It just seems strange that setting the search\_type=scan changes the  
behavior of \_search/scroll significantly (size=N semantics differ and no  
first page is returned).

On Thu, May 22, 2014 at 5:09 PM, Adrien Grand \<  
[adrien.grand@elasticsearch.com](mailto:adrien.grand@elasticsearch.com)\> wrote:

> scan is mainly useful as a way to export data from the index. In the  
> context of a user interface, I think scroll would make more sense[1]. On a  
> side note, paging improved significantly for scroll requests in  
> Elasticsearch 1.2 (in both terms of speed and memory usage).
> 
> [1]  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-scroll.html)
> 
> On Wed, May 21, 2014 at 8:28 PM, schmichael [michael@lytics.io](mailto:michael@lytics.io) wrote:
> 
> > On Wednesday, May 21, 2014 11:20:53 AM UTC-7, schmichael wrote:
> > 
> > > ...  
> > > 2. search\_type=scan doesn't seem to honor size=N
> > 
> > It seems I missed this in the guide:
> > 
> > "When scanning, the size is applied to each shard, so you will get back a  
> > maximum of size \* number\_of\_primary\_shards documents in each batch."
> > 
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/scan-scroll.html)
> > 
> > ...but that only seems to be the case with the scan search\_type. Do I  
> > just have to divide the user's requested page size by my number of shards  
> > (5 at this point)?
> > 
> > --  
> > 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/76d3e1eb-f0dd-46f3-a508-7b246b068e21%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/76d3e1eb-f0dd-46f3-a508-7b246b068e21%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/76d3e1eb-f0dd-46f3-a508-7b246b068e21%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/76d3e1eb-f0dd-46f3-a508-7b246b068e21%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Adrien Grand
> 
> --  
> 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/--2SuAbGjkk/unsubscribe](https://groups.google.com/d/topic/elasticsearch/--2SuAbGjkk/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/CAL6Z4j74g0Qqz0VLNDAHDEZ9N%3D2w723vEWaxqicfnQ\_Cn1DSfA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74g0Qqz0VLNDAHDEZ9N%3D2w723vEWaxqicfnQ_Cn1DSfA%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74g0Qqz0VLNDAHDEZ9N%3D2w723vEWaxqicfnQ\_Cn1DSfA%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74g0Qqz0VLNDAHDEZ9N%3D2w723vEWaxqicfnQ_Cn1DSfA%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/CANRei7AS2acfapr2n6wEkgc8rASEdrUZ9gnKnk8z084AUfTo1A%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CANRei7AS2acfapr2n6wEkgc8rASEdrUZ9gnKnk8z084AUfTo1A%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:27am UTC](https://discuss.elastic.co/t/-search-scroll-search-type-scan-bugs-inconsistencies/17652/5 "2017-07-06T01:27:30Z")

</div>


