Skip to content

Commit

Permalink
Merge pull request #979 from demianchuk/master
Browse files Browse the repository at this point in the history
Issue: Count feature missing #934
  • Loading branch information
demianchuk authored Jan 21, 2022
2 parents db5b226 + 1325702 commit 87a77bd
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Service/IndexService.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,21 @@ public function getIndexDocumentCount(): int
return $results['count'];
}

public function count(Search $search, array $params = [])
{
$body = array_merge(
[
'index' => $this->getIndexName(),
'body' => $search->toArray(),
],
$params
);

$results = $this->getClient()->count($body);

return $results['count'];
}

public function remove($id, $routing = null)
{
$params = [
Expand Down

0 comments on commit 87a77bd

Please sign in to comment.