Skip to content

Commit 72bcbe0

Browse files
committed
Added missing Aggregation factory methods
1 parent eadc6e6 commit 72bcbe0

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/Aggregation/Aggregation.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,27 @@ public static function topHits(string $name, array $aggregations = []): TopHitsA
107107
{
108108
return new TopHitsAggregation($name, $aggregations);
109109
}
110+
111+
public static function histogram(string $name, string $field, int $interval): HistogramAggregation
112+
{
113+
return new HistogramAggregation($name, $field, $interval);
114+
}
115+
116+
/**
117+
* @param array<int> $ranges pass desired ranges that will be converted to linear range
118+
*/
119+
public static function ranges(string $name, string $field, array $ranges): RangesAggregation
120+
{
121+
return new RangesAggregation($name, $field, $ranges);
122+
}
123+
124+
public static function widthHistogram(string $name, string $field, int $buckets): WidthHistogramAggregation
125+
{
126+
return new WidthHistogramAggregation($name, $field, $buckets);
127+
}
128+
129+
public static function stats(string $name): StatsAggregation
130+
{
131+
return new StatsAggregation($name);
132+
}
110133
}

0 commit comments

Comments
 (0)