Ok, I found that scroll can get terminate_after prm.
I have billions of records
I want to understand what happens behind the scenes
suppose I have 3 shards and each shard have 40,000 relevant query results
If I set terminate_after to 20,000
then each one of the 3 shards return 20 results
-> all of them together return 3 X 20,000 = 60,000 results to the coordinate node
suppose I have 1 master node, it process the results of each shard and assemble the query results.
then, scroll take piece by piece of the query results according to size in scroll (for example: 1000)
terminate after makes the query execution faster
when there is no terminate_after, the master node wait till it gets all the results from the shards
it can take a while if results number is high
and only after the master node have all the hits
scroll ask the data piece by piece
am I right ?
size in the query use internally in terminate after?
After using terminate after, can I tell the coordinate node to assemble just part of the data (for example - assemble till you have 5000 results) without using size(because its value is limited to 10000)?
after using terminate_after to limit results accurately I count the results that returned by yield and stop after reaching the desired number of results?
and thanks a lot!!