create() public method

Create a new bucket from it's type and params.
public create ( string $bucketType, array $bucketParams ) : Smile\ElasticsuiteCore\Search\Request\BucketInterface
$bucketType string Bucket type (must be a valid bucket type defined into the factories array).
$bucketParams array Bucket constructor params.
return Smile\ElasticsuiteCore\Search\Request\BucketInterface
 /**
  * Build the list of buckets from the mapping.
  *
  * @param ContainerConfigurationInterface $containerConfiguration Search request configuration
  * @param array                           $aggregations           Facet definitions.
  * @param array                           $filters                Facet filters to be added to buckets.
  *
  * @return BucketInterface[]
  */
 public function buildAggregations(ContainerConfigurationInterface $containerConfiguration, array $aggregations, array $filters)
 {
     $buckets = [];
     $mapping = $containerConfiguration->getMapping();
     foreach ($aggregations as $fieldName => $aggregationParams) {
         $bucketType = $aggregationParams['type'];
         try {
             $field = $mapping->getField($fieldName);
             $bucketParams = $this->getBucketParams($field, $aggregationParams, $filters);
             if (isset($bucketParams['filter'])) {
                 $bucketParams['filter'] = $this->createFilter($containerConfiguration, $bucketParams['filter']);
             }
             if (isset($bucketParams['nestedFilter'])) {
                 $nestedFilter = $this->createFilter($containerConfiguration, $bucketParams['nestedFilter']);
                 $bucketParams['nestedFilter'] = $nestedFilter->getQuery();
             }
         } catch (\Exception $e) {
             $bucketParams = $aggregationParams['config'];
         }
         $buckets[] = $this->aggregationFactory->create($bucketType, $bucketParams);
     }
     return $buckets;
 }