我在PHP + Mysql中整合弹性搜索。
据我所知,弹性搜索默认只返回10条记录。
以下是我的搜索查询。
$params = [
'index' => $this->client->getIndex(),
'type' => $this->client->getType(),
//"scroll" => "1m",
'body' => [
"query" => [
"bool" => [
"must" => [
[
"multi_match" => [
"fields" => ["prod_name", "prod_seo_name"],
"type" => "phrase_prefix",
"query" => 'samsung'
]
],
[
"term"=> ["cat_type_id"=>1]
]
]
]
]
],
];
$query = $client->search($params);
//return array($this->extractResult($query),$this->extractResult($query1));
return $this->extractResult($query);
以上查询在mysql中返回2000+记录但弹性搜索给出10.我可以在弹性搜索中放入'size upto 1000',但这不会填写要求。如何获取弹性搜索中的总记录数。我想在php中计算分页。