Php 如何在弹性搜索中获得无大小的总记录数
我想从弹性搜索中获得总记录数。 下面是我的代码Php 如何在弹性搜索中获得无大小的总记录数,php,
elasticsearch,Php,
elasticsearch,我想从弹性搜索中获得总记录数。 下面是我的代码 $params = [ 'index' => $this->client->getIndex(), 'type' => $this->client->getType(), "from" => 0, "size" => 10, //"scroll" => "1m", 'bo
$params = [
'index' => $this->client->getIndex(),
'type' => $this->client->getType(),
"from" => 0, "size" => 10,
//"scroll" => "1m",
'body' => [
"query" => [
"bool" => [
"must" => [
[
"multi_match" => [
"fields" => ["prod_name", "prod_seo_name"],
"type" => "phrase_prefix",
"query" => $query
]
],
[
"term"=> ["cat_type_id"=>1]
]
]
]
]
],
];
执行手动查询将提供400条记录,而弹性搜索将提供10条记录。无论大小,如何获取总记录?我认为应该可以通过以下方式访问:
$maxScore = $results['hits']['max_score'];
我认为应该可以通过以下方式访问:
$maxScore = $results['hits']['max_score'];