Skip to content

Commit 20abf2a

Browse files
committed
refactor: update alias handling to use updateAliases method
1 parent e9356d2 commit 20abf2a

1 file changed

Lines changed: 8 additions & 13 deletions

File tree

src/Model/Indices/MoveAlias.php

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,25 @@ public function __construct(
1818
public function execute(string $alias, string $indexFrom, string $indexTo): array
1919
{
2020
try {
21-
return $this->clientProvider->client()->indices()->putAlias(
22-
(
23-
new \Spameri\ElasticQuery\Document(
24-
$indexFrom,
25-
new \Spameri\ElasticQuery\Document\Body\Plain(
26-
[
27-
'actions' => [
21+
return $this->clientProvider->client()->indices()->updateAliases(
22+
[
23+
'body' => [
24+
'actions' => [
25+
[
2826
'remove' => [
2927
'index' => $indexFrom,
3028
'alias' => $alias,
3129
],
30+
],
31+
[
3232
'add' => [
3333
'index' => $indexTo,
3434
'alias' => $alias,
3535
],
3636
],
3737
],
38-
),
39-
null,
40-
[
41-
'name' => $indexTo,
4238
],
43-
)
44-
)->toArray(),
39+
],
4540
)->asArray()
4641
;
4742

0 commit comments

Comments
 (0)