protected function execute(InputInterface
$input, OutputInterface
$output) { $shopId =
$input->
getArgument('shopId'
);
$type =
$input->
getArgument('type'
);
$indexName =
$input->
getArgument('index'
);
/** @var Shop $shop */
$shop =
$this->container->
get(ShopGatewayInterface::
class)->
get($shopId);
/** @var ShopIndex $index */
$index =
$this->container->
get(IndexFactory::
class) ->
createShopIndex($shop,
$type);
/** @var Client $client */
$client =
$this->container->
get(Client::
class);
$exist =
$client->
indices()->
exists(['index' =>
$indexName]);
if (!
$exist) { throw new RuntimeException(sprintf('Index "%s" does not exist',
$indexName));
} $actions =
[ ['add' =>
['index' =>
$indexName, 'alias' =>
$index->
getName()]],
];