Detecting end of Scroll


#1

According to the documentation, you know when you have reached the end of
the scroll results when you receive zero hits in the response.
However, if your SearchType is SCAN, then you receive zero hits in the
first result,
The question is how to avoid this ambiguity.

My code that handles the scrolling results doesn't know what the SearchType
is - so it doesn't know how to differentiate between the two scenarios of
in which we receive zero hits.

Can the end of the results not be signalled through the scrollId?
I kind of expected the scrollId to be null when we reached the end of the
results (but I can see its not).

That said, I do notice that when the end of the results are reached, the
scrollId stops changing - and its also a lot shorter - and also it seems to
always be the same value (c2NhbjswOzE7dG90YWxfaGl0czoxOw==)

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/6a9da841-1c70-4179-a0ba-b6f145363e23%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Ralph Meijer) #2

On Mon, Jun 16, 2014 at 07:45:00AM -0700, mooky wrote:

[..]
That said, I do notice that when the end of the results are reached, the
scrollId stops changing - and its also a lot shorter - and also it seems to
always be the same value (c2NhbjswOzE7dG90YWxfaGl0czoxOw==)

That scroll id is the base64 encoding of the following string:

scan;0;1;total_hits:1;

--
Groetjes,

ralphm

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/20140616145804.GB25839%40ik.nu.
For more options, visit https://groups.google.com/d/optout.


#3

Oh, I see.
Can we make any assumption about the scrollId not changing when we reach
the end of the results?

On Monday, 16 June 2014 15:58:20 UTC+1, Ralph Meijer wrote:

On Mon, Jun 16, 2014 at 07:45:00AM -0700, mooky wrote:

[..]
That said, I do notice that when the end of the results are reached, the
scrollId stops changing - and its also a lot shorter - and also it seems
to
always be the same value (c2NhbjswOzE7dG90YWxfaGl0czoxOw==)

That scroll id is the base64 encoding of the following string:

scan;0;1;total_hits:1;

--
Groetjes,

ralphm

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/34e73a88-285e-4ea7-8468-5dc11b7ee9bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


#4

Just to confirm:
Is it correct that in order to automatically clean up the resources
associated with a scroll, you must execute it until zero results are
retrieved?
What about the case when all of the hits are returned in the first result
(ie num hits = total hits)

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/bb66ee75-c40b-465e-96c7-6433c4c08a58%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #5