How to do scan and scroll using Elastic4s


#1

I am using Elastic4s (SCALA client for elastic search). I need to retrieve all 10 millions documents in an index. I think the right way to do is using scan and scroll.

Is there any code snippet or examples showing how to do scan and scroll using Elastic4s?


(Stephen Samuel) #2
client.execute {
   search in "index" / "type" query <yourquery> scroll "1m"
}

then

client.execute {
   search scroll <id>
}

This example should help:
https://github.com/sksamuel/elastic4s/blob/master/elastic4s-core%2Fsrc%2Ftest%2Fscala%2Fcom%2Fsksamuel%2Felastic4s%2FScrollTest.scala


(Daniel Pinyol Laserna) #3

I guess the updated link is https://github.com/sksamuel/elastic4s/blob/master/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/search/ScrollHttpTest.scala or https://github.com/sksamuel/elastic4s/blob/master/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/search/ScrollTcpTest.scala


(system) #4