private function replaceAggregationFilter($aggregationConfig)
    {
        if (isset($aggregationConfig['filters'])) {
            $filters = [];

            foreach ($aggregationConfig['filters'] as $filterName => $filterClass) {
                // Done in \Smile\ElasticsuiteCore\Search\Request\ContainerConfiguration for query filters.
                $filters[$filterName] = $this->objectManager->get($filterClass)->getFilterQuery();
            }

            $aggregationConfig['filters'] = $filters;
        }

        if (isset($aggregationConfig['childBuckets'])) {
            $childBuckets = [];
            foreach ($aggregationConfig['childBuckets'] as $aggName => $aggConfig) {
                $childBuckets[$aggName] = $this->replaceAggregationFilter($aggConfig);
            }

            $aggregationConfig['childBuckets'] = $childBuckets;
        }

        return $aggregationConfig;
    }