We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 90b0fee commit 2214fd1Copy full SHA for 2214fd1
1 file changed
src/Aggregation/Filter.php
@@ -0,0 +1,27 @@
1
+<?php declare(strict_types = 1);
2
+
3
+namespace Spameri\ElasticQuery\Aggregation;
4
5
+/**
6
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-filter-aggregation.html
7
+ */
8
+class Filter extends \Spameri\ElasticQuery\Filter\FilterCollection
9
+ implements \Spameri\ElasticQuery\Aggregation\LeafAggregationInterface
10
+{
11
12
+ public function toArray(): array
13
+ {
14
+ $array = parent::toArray();
15
16
+ if ($array === []) {
17
+ $array['must'] = [];
18
+ }
19
20
+ return [
21
+ 'filter' => [
22
+ 'bool' => $array,
23
+ ],
24
+ ];
25
26
27
+}
0 commit comments