Skip to content

Commit 87a77bd

Browse files
authored
Merge pull request #979 from demianchuk/master
Issue: Count feature missing #934
2 parents db5b226 + 1325702 commit 87a77bd

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Service/IndexService.php

+15
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,21 @@ public function getIndexDocumentCount(): int
318318
return $results['count'];
319319
}
320320

321+
public function count(Search $search, array $params = [])
322+
{
323+
$body = array_merge(
324+
[
325+
'index' => $this->getIndexName(),
326+
'body' => $search->toArray(),
327+
],
328+
$params
329+
);
330+
331+
$results = $this->getClient()->count($body);
332+
333+
return $results['count'];
334+
}
335+
321336
public function remove($id, $routing = null)
322337
{
323338
$params = [

0 commit comments

Comments
 (0)