Skip to content

Commit

Permalink
Try add alias before removing the old alias
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Oct 3, 2023
1 parent c47b25a commit e58c22d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions console/src/Index/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ public function refreshIndex(string $name): void
public function setAlias(string $index, string $alias, ?string $oldIndex = null): void
{
$actions = [];
$actions[] = [
'add' => [
'index' => $index,
'alias' => $alias,
],
];
if ($oldIndex) {
$actions[] = [
'remove' => [
Expand All @@ -209,12 +215,6 @@ public function setAlias(string $index, string $alias, ?string $oldIndex = null)
],
];
}
$actions[] = [
'add' => [
'index' => $index,
'alias' => $alias,
],
];

$client = new Client();
$response = $client->post(
Expand Down

0 comments on commit e58c22d

Please sign in to comment.