How to elasticsearch return all hits


(Ho Duc Khoa) #1

Code :
$client = ClientBuilder::create()->build(); $params = [ 'index' => 'rbmq', 'type' => 'users', 'body' => [ 'query' => [ 'match' => [ 'email' => [ 'query' =>'@gmail.com', 'operator'=>'and' ] ], ] ] ]; $results = $client->search($params); $r=$results["hits"]["hits"]; $total = $results["hits"]["total"]; echo "TOTAL: ". $total ."<br>"; foreach ($r as $key ) { echo $key["_source"]["email"],"<br>" ; echo $key["_source"]["username"]; echo "<br>"; }
Result:
TOTAL: 13
return hits: 10 hits, WHY??,


(Christian Dahlqvist) #2

You can specify a size parameter (which defaults to 10) to determine the number of results to be returned. This is limited at 10000, as you should use a scroll query if you want to retrieve larger volumes of data.


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.