$data =
$elasticResult['aggregations'
]['properties'
]['buckets'
];
$ids =
array_column($data, 'key'
);
if (empty($ids)) { return;
} $groupIds =
$this->
getGroupIds($ids);
$search =
new EsSearch();
$search->
addQuery(new IdsQuery($groupIds), BoolQuery::FILTER
);
$search->
addQuery(new TermQuery('filterable', true
), BoolQuery::FILTER
);
$search->
addSort(new FieldSort('name', 'asc'
));
$search->
setFrom(0
);
$search->
setSize(self::AGGREGATION_SIZE
);
$index =
$this->indexFactory->
createShopIndex($context->
getShop(), PropertyMapping::TYPE
);
$arguments =
[ 'index' =>
$index->
getName(),
'body' =>
$search->
toArray(),
'rest_total_hits_as_int' => true,