Classes/Eel/ElasticSearchQueryBuilder.php
public function aggregation(string $name, array $aggregationDefinition, string $parentPath = ''): ElasticSearchQueryBuilder
    {
        $this->request->aggregation($name, $aggregationDefinition, $parentPath);

        return $this;
    }
public function aggregation(string $name, array $aggregationDefinition, string $parentPath = ''): ElasticSearchQueryBuilder
    {
        $this->request->aggregation($name, $aggregationDefinition, $parentPath);

        return $this;
    }
public function aggregation ( string $ name , array $ aggregationDefinition , string $ parentPath = '' ) : ElasticSearchQueryBuilder { $ this -> request -> aggregation ( $ name , $ aggregationDefinition , $ parentPath ) ; return $ this ; }
This method is used to create any kind of aggregation.

Example Usage to create a terms aggregation for a property color:

aggregationDefinition = Neos.Fusion:RawArray {
terms = Neos.Fusion:RawArray {
field = "color"
}
}

nodes = ${Search....aggregation("color", this.aggregationDefinition).execute()}

Access all aggregation data with {nodes.aggregations} in your fluid template

@param string $name
@param array $aggregationDefinition
@param string $parentPath
@return ElasticSearchQueryBuilder
@throws QueryBuildingException
This method is used to create any kind of aggregation .