Classes/Eel/ElasticSearchQueryBuilder.php
public function fieldBasedAggregation(string $name, string $field, string $type = 'terms', string $parentPath = '', int $size = 10): ElasticSearchQueryBuilder
    {
        $aggregationDefinition = [
            $type => [
                'field' => $field,
                'size' => $size
            ]
        ];

        $this->aggregation($name, $aggregationDefinition, $parentPath);

        return $this;
    }
public function fieldBasedAggregation(string $name, string $field, string $type = 'terms', string $parentPath = '', int $size = 10): ElasticSearchQueryBuilder
    {
        $aggregationDefinition = [
            $type => [
                'field' => $field,
                'size' => $size
            ]
        ];

        $this->aggregation($name, $aggregationDefinition, $parentPath);

        return $this;
    }
public function fieldBasedAggregation ( string $ name , string $ field , string $ type = 'terms' , string $ parentPath = '' , int $ size = 10 ) : ElasticSearchQueryBuilder { $ aggregationDefinition = [ $ type => [ 'field' => $ field , 'size' => $ size ] ] ; $ this -> aggregation ( $ name , $ aggregationDefinition , $ parentPath ) ; return $ this ; }
This method adds a field based aggregation configuration. This can be used for simple
aggregations like terms

Example Usage to create a terms aggregation for a property color:
nodes = ${Search....fieldBasedAggregation("colors", "color").execute()}

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

@param string $name The name to identify the resulting aggregation
@param string $field The field to aggregate by
@param string $type Aggregation type
@param string $parentPath
@param int $size The amount of buckets to return
@return ElasticSearchQueryBuilder
@throws QueryBuildingException
This method adds a field based aggregation configuration . This can be used for simple aggregations like terms