# Using scroll and choosing on types

**URL:** <https://discuss.elastic.co/t/using-scroll-and-choosing-on-types/12413>\
**Category:** Elasticsearch\
**Created:** [June 14, 2013, 7:19am UTC](https://discuss.elastic.co/t/using-scroll-and-choosing-on-types/12413 "2013-06-14T07:19:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sujoysett](https://avatars.discourse-cdn.com/v4/letter/s/2acd7d/32.png) [@sujoysett](https://discuss.elastic.co/u/sujoysett)\
**Post date:** [June 14, 2013, 7:19am UTC](https://discuss.elastic.co/t/using-scroll-and-choosing-on-types/12413/1 "2013-06-14T07:19:34Z")

</div>

Hi,

One confusion about using search types in scroll ....

curl -XGET  
'://\_search?search\_type=scan&scroll=10m&size=50&pretty=1'  
-d '{  
"query" : {  
"match\_all" : {}  
}  
}'

gives me only the scroll ID and an empty array in hits. This is expected.  
Next I use this scroll ID to get hits, chaining the returned scroll ID in  
every subsequent request.

curl -XGET  
'://\_search?search\_type=dfs\_query\_then\_fetch&scroll=10m&size=50&pretty=1'  
-d '{  
"query" : {  
"match\_all" : {}  
}  
}'

gives me the scroll ID and some hits. Why the hits are also getting  
returned in this step when using dfs\_query\_then\_fetch instead of scan?

Tried using POST and not GET, but same results.

Any help?

Thanks,

- Sujoy.

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![sujoysett](https://avatars.discourse-cdn.com/v4/letter/s/2acd7d/32.png) [@sujoysett](https://discuss.elastic.co/u/sujoysett)\
**Post date:** [June 18, 2013, 4:48am UTC](https://discuss.elastic.co/t/using-scroll-and-choosing-on-types/12413/2 "2013-06-18T04:48:51Z")

</div>

Hi,

Sorry for repeated request, but I am still confused on this issue.  
Am I doing something wrong in my query, or missing any additional parameter?

Thanks in advance,

- Sujoy.

On Friday, June 14, 2013 12:49:34 PM UTC+5:30, Sujoy Sett wrote:

> Hi,
> 
> One confusion about using search types in scroll ....
> 
> curl -XGET  
> '://\_search?search\_type=scan&scroll=10m&size=50&pretty=1'  
> -d '{  
> "query" : {  
> "match\_all" : {}  
> }  
> }'
> 
> gives me only the scroll ID and an empty array in hits. This is expected.  
> Next I use this scroll ID to get hits, chaining the returned scroll ID in  
> every subsequent request.
> 
> curl -XGET  
> '://\_search?search\_type=dfs\_query\_then\_fetch&scroll=10m&size=50&pretty=1'  
> -d '{  
> "query" : {  
> "match\_all" : {}  
> }  
> }'
> 
> gives me the scroll ID and some hits. Why the hits are also getting  
> returned in this step when using dfs\_query\_then\_fetch instead of scan?
> 
> Tried using POST and not GET, but same results.
> 
> Any help?
> 
> Thanks,
> 
> - Sujoy.

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [June 24, 2013, 1:26pm UTC](https://discuss.elastic.co/t/using-scroll-and-choosing-on-types/12413/3 "2013-06-24T13:26:52Z")

</div>

Hey,

you cannot combine dfs search type with scroll request parameters. The  
scroll parameter only works if the search type is scan.  
What are you trying to achieve by mixing these?

--Alex

On Tue, Jun 18, 2013 at 6:48 AM, Sujoy Sett [sujoysett@gmail.com](mailto:sujoysett@gmail.com) wrote:

> Hi,
> 
> Sorry for repeated request, but I am still confused on this issue.  
> Am I doing something wrong in my query, or missing any additional  
> parameter?
> 
> Thanks in advance,
> 
> - Sujoy.
> 
> On Friday, June 14, 2013 12:49:34 PM UTC+5:30, Sujoy Sett wrote:
> 
> > Hi,
> > 
> > One confusion about using search types in scroll ....
> > 
> > curl -XGET '://\_\*\*search?search\_type=scan&\*\*scroll=10m&size=50&pretty=1'  
> > -d '{  
> > "query" : {  
> > "match\_all" : {}  
> > }  
> > }'
> > 
> > gives me only the scroll ID and an empty array in hits. This is expected.  
> > Next I use this scroll ID to get hits, chaining the returned scroll ID in  
> > every subsequent request.
> > 
> > curl -XGET '://_\*\*search?search\_type=dfs\_query_\*\*  
> > then\_fetch&scroll=10m&size=50&\*\*pretty=1' -d '{  
> > "query" : {  
> > "match\_all" : {}  
> > }  
> > }'
> > 
> > gives me the scroll ID and some hits. Why the hits are also getting  
> > returned in this step when using dfs\_query\_then\_fetch instead of scan?
> > 
> > Tried using POST and not GET, but same results.
> > 
> > Any help?
> > 
> > Thanks,
> > 
> > - Sujoy.
> 
> --  
> 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).  
> 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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![sujoysett](https://avatars.discourse-cdn.com/v4/letter/s/2acd7d/32.png) [@sujoysett](https://discuss.elastic.co/u/sujoysett)\
**Post date:** [June 24, 2013, 2:05pm UTC](https://discuss.elastic.co/t/using-scroll-and-choosing-on-types/12413/4 "2013-06-24T14:05:51Z")

</div>

Hi Alex,

The applications I work on needs processing and remodeling of data indexed  
in ES, which necessarily involves re-indexing of documents.

When such processing runs on an entire index, we use scroll along with scan  
search type and match\_all query.  
But when we need a processing re-run on selective documents, we use scroll  
with dfs\_query\_then\_fetch search type and requirement specific term or  
range query.

I don't know why you are saying these can not be mixed. It does work, and  
it is working in my code from ES version 0.19.\* onward. I actually  
revisited my code before posting this reply just to confirm my words.

-- Sujoy.

On Monday, June 24, 2013 6:56:52 PM UTC+5:30, Alexander Reelsen wrote:

> Hey,
> 
> you cannot combine dfs search type with scroll request parameters. The  
> scroll parameter only works if the search type is scan.  
> What are you trying to achieve by mixing these?
> 
> --Alex
> 
> On Tue, Jun 18, 2013 at 6:48 AM, Sujoy Sett \<[sujo...@gmail.com](mailto:sujo...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > Hi,
> > 
> > Sorry for repeated request, but I am still confused on this issue.  
> > Am I doing something wrong in my query, or missing any additional  
> > parameter?
> > 
> > Thanks in advance,
> > 
> > - Sujoy.
> > 
> > On Friday, June 14, 2013 12:49:34 PM UTC+5:30, Sujoy Sett wrote:
> > 
> > > Hi,
> > > 
> > > One confusion about using search types in scroll ....
> > > 
> > > curl -XGET '://\_\*\*search?search\_type=scan&\*\*scroll=10m&size=50&pretty=1'  
> > > -d '{  
> > > "query" : {  
> > > "match\_all" : {}  
> > > }  
> > > }'
> > > 
> > > gives me only the scroll ID and an empty array in hits. This is  
> > > expected. Next I use this scroll ID to get hits, chaining the returned  
> > > scroll ID in every subsequent request.
> > > 
> > > curl -XGET '://_\*\*search?search\_type=dfs\_query_\*\*  
> > > then\_fetch&scroll=10m&size=50&\*\*pretty=1' -d '{  
> > > "query" : {  
> > > "match\_all" : {}  
> > > }  
> > > }'
> > > 
> > > gives me the scroll ID and some hits. Why the hits are also getting  
> > > returned in this step when using dfs\_query\_then\_fetch instead of scan?
> > > 
> > > Tried using POST and not GET, but same results.
> > > 
> > > Any help?
> > > 
> > > Thanks,
> > > 
> > > - Sujoy.
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > 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).  
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, 2:29am UTC](https://discuss.elastic.co/t/using-scroll-and-choosing-on-types/12413/5 "2017-07-06T02:29:47Z")

</div>


