Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Elasticsearch stream results?

Does Elasticsearch stream the query results as they are "calculated" or does it calculate everything and then return the final response back to the client?

like image 686
user432024 Avatar asked Jun 20 '14 15:06

user432024


2 Answers

By default elasticsearch will only return a limited set of results for a query. (i.e. searching for * will only return the default count set regardless of the number of matches).

Generally to implement "streaming" , you make an initial search to get total count of matching documents and then ask for documents in ranges ( i.e. first 10, next 10, etc.. )

See

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-from-size.html

for how to request the number of documents returned.

like image 102
Fred the Magic Wonder Dog Avatar answered Sep 28 '22 00:09

Fred the Magic Wonder Dog


Have you tried scroll query?

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html much easier to deal with than pagination.

Scrolling is not intended for real time user requests, but rather for processing large amounts of data, e.g. in order to reindex the contents of one index into a new index with a different configuration.

like image 34
Anton Kokarski Avatar answered Sep 28 '22 00:09

Anton Kokarski