Classes/Driver/AbstractQuery.php
protected function addSubAggregation(string $parentPath, string $name, array $aggregationConfiguration): void
    {
        // Find the parentPath
        $path =& $this->request['aggregations'];

        foreach (explode('.', $parentPath) as $subPart) {
            if ($path === null || !array_key_exists($subPart, $path)) {
                throw new Exception\QueryBuildingException(sprintf('The parent path segment "%s" could not be found when adding a sub aggregation to parent path "%s"', $subPart, $parentPath));
            }
            $path =& $path[$subPart]['aggregations'];
        }

        $path[$name] = $aggregationConfiguration;
    }
protected function addSubAggregation(string $parentPath, string $name, array $aggregationConfiguration): void
    {
        // Find the parentPath
        $path =& $this->request['aggregations'];

        foreach (explode('.', $parentPath) as $subPart) {
            if ($path === null || !array_key_exists($subPart, $path)) {
                throw new Exception\QueryBuildingException(sprintf('The parent path segment "%s" could not be found when adding a sub aggregation to parent path "%s"', $subPart, $parentPath));
            }
            $path =& $path[$subPart]['aggregations'];
        }

        $path[$name] = $aggregationConfiguration;
    }
protected function addSubAggregation ( string $ parentPath , string $ name , array $ aggregationConfiguration ) : void { // Find the parentPath $ path = & $ this -> request [ 'aggregations' ] ; foreach ( explode ( '.' , $ parentPath ) as $ subPart ) { if ( $ path === null || ! array_key_exists ( $ subPart , $ path ) ) { throw new Exception \ QueryBuildingException ( sprintf ( 'The parent path segment "%s" could not be found when adding a sub aggregation to parent path "%s"' , $ subPart , $ parentPath ) ) ; } $ path = & $ path [ $ subPart ] [ 'aggregations' ] ; } $ path [ $ name ] = $ aggregationConfiguration ; }
This is an low level method for internal usage.

You can add a custom $aggregationConfiguration under a given $parentPath. The $parentPath foo.bar would
insert your $aggregationConfiguration under
$this->request['aggregations']['foo']['aggregations']['bar']['aggregations'][$name]

@param string $parentPath The parent path to add the sub aggregation to
@param string $name The name to identify the resulting aggregation
@param array $aggregationConfiguration
@return void
@throws Exception\QueryBuildingException
This is an low level method for internal usage .