CodeExplorer switchAlias example
$this->backlogReader->
setLastBacklogId($lastId);
} private function createAlias(IndexConfiguration
$configuration) { $currentAlias =
$configuration->
getAlias();
$aliasExists =
$this->client->
indices()->
existsAlias(['name' =>
$currentAlias]);
if ($aliasExists) { $this->
switchAlias($configuration);
return;
} $indexExists =
$this->client->
indices()->
exists(['index' =>
$currentAlias]);
if ($indexExists) { $this->client->
indices()->
delete(['index' =>
$currentAlias]);
} $this->client->
indices()->
putAlias([ 'index' =>
$configuration->
getName(),
$this->client->
indices()->
refresh(['index' =>
$index]);
$progress->
finish();
$this->evaluation->
finish();
} private function createAlias(string
$index, string
$alias): void
{ $exist =
$this->client->
indices()->
existsAlias(['name' =>
$alias]);
if ($exist) { $this->
switchAlias($index,
$alias);
return;
} $this->client->
indices()->
putAlias([ 'index' =>
$index,
'name' =>
$alias,
]);
} private function switchAlias(string
$index, string
$alias): void
{