ElasticSearch. Does scroll require scan?

229 Views Asked by At

Using ElasticSearch 1.2.1

I have a few questions regarding scroll.

I would like to export a fairly large amount of documents based on a specified query and ORDER DOES MATTER.

1- Does scroll require scan? Because the docs mention to see scan for more information regarding scroll. 2- If I understand correctly to go through the full scroll, you keep scrolling until you get nothing back? 3- Does scrolling use RAM or cahce the results?

3

There are 3 best solutions below

0
On

It doesn't seem that scroll requires scan but rather you can use both together if wanted.

0
On
  1. Nope, it doesn't. In fact, if order does matter, you can't use scan.
  2. Yes, each time passing new scrollId returned by previous scroll query (it will differ for each call).
  3. To be honest i don't know, but it keeps the state of your query between scrolls for amount of time you choose, so it uses RAM i think. I suppose it doesn't cache results.
0
On

Scan is a search type, there are few search type you can specify to match your results and improve performance. Scan does fetch the doc in the order they are, that is sort by doc order. If you dont use scan then probably you should explicitly mention the sort order with the search query. If you mention any other sort parameter then its a overload for a merger while scrolling, hence scan is preferred.