Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get all the values from an search result

I am new to Elastic Search. Is there any way to get all the search results for a search keyword? Elastic Search is limited to 10 or else we can set the size but we need to get the size??

like image 754
raagavan Avatar asked Feb 14 '11 09:02

raagavan


2 Answers

Yes, the default number of search results is 10.

You need to set the size parameter on the query.

I don't think you an say "all results", though, there must always be a size limit.

like image 82
skaffman Avatar answered Oct 26 '22 21:10

skaffman


If you use the JAVA API you can simple get the total hit number from the SearchResponse

SearchRequestBuilder srb = ..
SearchResponse sr = srb.execute().actionGet();
long totalHits = sr.getHits().getTotalHits();
like image 42
matthias Avatar answered Oct 26 '22 21:10

matthias