Isswp101\Persimmon\Collection\ElasticsearchCollection::getAggregation PHP Method

getAggregation() public method

public getAggregation ( string $name ) : Bucket[]
$name string
return Isswp101\Persimmon\QueryBuilder\Aggregations\Bucket[]
    public function getAggregation($name)
    {
        $buckets = [];
        $items = Arr::get($this->response, 'aggregations.' . $name . '.buckets', []);
        foreach ($items as $item) {
            $buckets[] = new Bucket($item['key'], $item['doc_count']);
        }
        return $buckets;
    }