ElasticSearch Count API,在php

时间:2018-10-05 14:28:09

标签: php elasticsearch

是否可以在一个请求中对具有不同查询过滤器的多个索引进行计数?

https://www.elastic.co/guide/en/elasticsearch/reference/6.2/search-count.html

类似这样的事情: https://www.elastic.co/guide/en/elasticsearch/reference/6.2/search-multi-search.html

但随后是Count API。 有一个multi-index选项,但是它只会对匹配进行汇总,并且在初始计数查询过滤器不同时将不起作用。

$this->client = ClientBuilder::fromConfig(SOME_CONFIG);

$results1 =$this->client->count($SomeQueryOnIndex1);
$results2 =$this->client->count($SomeQueryOnIndex2);
$results3 =$this->client->count($SomeQueryOnIndex3);

// Would love to reduce those 3 requests to one.
$mergedQueries = $SomeQueryOnIndex1 +$SomeQueryOnIndex2 + $SomeQueryOnIndex3

//  Something like this ...
$results = $this>client->mcount($mergedQueries);

//..and then have for each index/query the number of hits.

这可能吗?

0 个答案:

没有答案