Skip to content

Commit 8925747

Browse files
committed
Added Max aggregation
1 parent 2214fd1 commit 8925747

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

src/Aggregation/Max.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace Spameri\ElasticQuery\Aggregation;
4+
5+
class Max implements \Spameri\ElasticQuery\Aggregation\LeafAggregationInterface
6+
{
7+
8+
private string $field;
9+
10+
11+
public function __construct(
12+
string $field
13+
)
14+
{
15+
$this->field = $field;
16+
}
17+
18+
19+
public function key(): string
20+
{
21+
return 'max_' . $this->field;
22+
}
23+
24+
25+
/**
26+
* @return array<string, array<string, string>>
27+
*/
28+
public function toArray(): array
29+
{
30+
return [
31+
'max' => [
32+
'field' => $this->field,
33+
],
34+
];
35+
}
36+
37+
}

0 commit comments

Comments
 (0)