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??,
elasticsearch limits the number of records returned by any query to 10 records by default
Yep. Increase the size parameter, or use the scroll api to retrieve a very large list of hits.
@hoduckhoa Questions like this are best asked at the Elasticsearch Discuss Forums. We try to reserve tickets in this repository for bugs, feature requests and help with the Elasticsearch-PHP client itself, not general Elasticsearch questions. Thanks!
Most helpful comment
elasticsearch limits the number of records returned by any query to 10 records by default