简体   繁体   English

如何在弹性搜索中获取没有大小的总记录数

[英]how to get count of total records without size in elastic search

I want to get count of total records from elastic search. 我想从弹性搜索中获取总记录数。 below is my code 下面是我的代码

 $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]
                     ]
                  ]
               ]
            ]
            ],
       ];

Executing manual query is giving 400 records whereas elastic search giving 10 records. 执行手动查询将显示400条记录,而弹性搜索将显示10条记录。 How do I get total records regardless of size.? 不论大小,如何获取总记录?

我认为应该可以通过低谷访问:

$maxScore     = $results['hits']['max_score'];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM