private function parseAggregations(\DOMXPath $xpath, \DOMNode $rootNode)
    {
        $aggs = [];

        foreach ($xpath->query(self::AGGREGATIONS_PATH, $rootNode) as $aggNode) {
            $bucketName   = $aggNode->getAttribute('name');
            $bucketConfig = [];

            foreach ($aggNode->attributes as $attribute) {
                $bucketConfig[$attribute->name] = $attribute->value;
            }
            $aggFilters = $this->parseAggregationFilters($xpath, $aggNode);
            if (!empty($aggFilters)) {
                $bucketConfig['filters'] = $aggFilters;
            }
            $bucketConfig['childBuckets'] = $this->parseAggregations($xpath, $aggNode);
            $bucketConfig['metrics'] = $this->parseMetrics($xpath, $aggNode);
            $bucketConfig['pipelines'] = $this->parsePipelines($xpath, $aggNode);
            $aggs[$bucketName] = $bucketConfig;
        }

        return $aggs;
    }
private function parseAggregations(\DOMXPath $xpath, \DOMNode $rootNode)
    {
        $aggs = [];

        foreach ($xpath->query(self::AGGREGATIONS_PATH, $rootNode) as $aggNode) {
            $bucketName   = $aggNode->getAttribute('name');
            $bucketConfig = [];

            foreach ($aggNode->attributes as $attribute) {
                $bucketConfig[$attribute->name] = $attribute->value;
            }
            $aggFilters = $this->parseAggregationFilters($xpath, $aggNode);
            if (!empty($aggFilters)) {
                $bucketConfig['filters'] = $aggFilters;
            }
            $bucketConfig['childBuckets'] = $this->parseAggregations($xpath, $aggNode);
            $bucketConfig['metrics'] = $this->parseMetrics($xpath, $aggNode);
            $bucketConfig['pipelines'] = $this->parsePipelines($xpath, $aggNode);
            $aggs[$bucketName] = $bucketConfig;
        }

        return $aggs;
    }
private function parseAggregations ( \ DOMXPath $ xpath , \ DOMNode $ rootNode ) { $ aggs = [ ] ; foreach ( $ xpath -> query ( self :: AGGREGATIONS_PATH , $ rootNode ) as $ aggNode ) { $ bucketName = $ aggNode -> getAttribute ( 'name' ) ; $ bucketConfig = [ ] ; foreach ( $ aggNode -> attributes as $ attribute ) { $ bucketConfig [ $ attribute -> name ] = $ attribute -> value ; } $ aggFilters = $ this -> parseAggregationFilters ( $ xpath , $ aggNode ) ; if ( ! empty ( $ aggFilters ) ) { $ bucketConfig [ 'filters' ] = $ aggFilters ; } $ bucketConfig [ 'childBuckets' ] = $ this -> parseAggregations ( $ xpath , $ aggNode ) ; $ bucketConfig [ 'metrics' ] = $ this -> parseMetrics ( $ xpath , $ aggNode ) ; $ bucketConfig [ 'pipelines' ] = $ this -> parsePipelines ( $ xpath , $ aggNode ) ; $ aggs [ $ bucketName ] = $ bucketConfig ; } return $ aggs ; }
Parse aggregations from request node configuration.

@param \DOMXPath $xpath    XPath access to the document parsed.
@param \DOMNode  $rootNode Request node to be parsed.

@return array
Parse aggregations from request node configuration .