private function getBuckets($rawAggregations)
    {
        $buckets = [];

        foreach ($rawAggregations as $bucketName => $rawBucket) {
            while (isset($rawBucket[$bucketName])) {
                $rawBucket = $rawBucket[$bucketName];
            }

            $bucketParams = ['name' => $bucketName, 'values' => $this->getBucketValues($rawBucket)];
            $buckets[$bucketName] = $this->bucketFactory->create($bucketParams);
        }

        return $buckets;
    }
private function getBuckets($rawAggregations)
    {
        $buckets = [];

        foreach ($rawAggregations as $bucketName => $rawBucket) {
            while (isset($rawBucket[$bucketName])) {
                $rawBucket = $rawBucket[$bucketName];
            }

            $bucketParams = ['name' => $bucketName, 'values' => $this->getBucketValues($rawBucket)];
            $buckets[$bucketName] = $this->bucketFactory->create($bucketParams);
        }

        return $buckets;
    }
private function getBuckets ( $ rawAggregations ) { $ buckets = [ ] ; foreach ( $ rawAggregations as $ bucketName => $ rawBucket ) { while ( isset ( $ rawBucket [ $ bucketName ] ) ) { $ rawBucket = $ rawBucket [ $ bucketName ] ; } $ bucketParams = [ 'name' => $ bucketName , 'values' => $ this -> getBucketValues ( $ rawBucket ) ] ; $ buckets [ $ bucketName ] = $ this -> bucketFactory -> create ( $ bucketParams ) ; } return $ buckets ; }
Return buckets from an ES aggregation.

@param array $rawAggregations ES aggregations.

@return \Magento\Framework\Search\Response\Bucket[]
Return buckets from an ES aggregation .