Skip to content

Commit

Permalink
Merge pull request #37 from sventendo/feature/filter-aggregation
Browse files Browse the repository at this point in the history
Allow filter aggregation without nested aggregations
  • Loading branch information
AlexVanderbist authored May 6, 2024
2 parents 7ba2c1a + 5bd2cad commit 329564b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Aggregations/FilterAggregation.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@ public function __construct(

public function payload(): array
{
return [
$aggregation = [
'filter' => $this->filter->toArray(),
'aggs' => $this->aggregations->toArray(),
];

if (! $this->aggregations->isEmpty()) {
$aggregation['aggs'] = $this->aggregations->toArray();
}

return $aggregation;
}
}

0 comments on commit 329564b

Please sign in to comment.