Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenSearch 2.3.0 indices:admin/aliases for '_all' indices is not allowed for a regular user #122

Open
kftseng opened this issue Nov 6, 2022 · 2 comments

Comments

@kftseng
Copy link

kftseng commented Nov 6, 2022

must patch IndexBuilder.php~

*** jolicode/elastically/src/IndexBuilder.php~ 2022-11-07 04:22:55.000000000 +0800
--- jolicode/elastically/src/IndexBuilder.php 2022-11-07 04:24:35.888045057 +0800
***************
*** 64,70 ****
$data = ['actions' => []];
! $data['actions'][] = ['remove' => ['index' => '*', 'alias' => $indexName]];
$data['actions'][] = ['add' => ['index' => $index->getName(), 'alias' => $indexName]];
var_dump(json_encode($data));
return $this->client->request('_aliases', Request::POST, $data);
--- 64,70 ----
$data = ['actions' => []];
! $data['actions'][] = ['remove' => ['index' => $indexName . '*', 'alias' => $indexName]];
$data['actions'][] = ['add' => ['index' => $index->getName(), 'alias' => $indexName]];
var_dump(json_encode($data));
return $this->client->request('_aliases', Request::POST, $data);
@lyrixx
Copy link
Member

lyrixx commented Nov 9, 2022

Hello,

Would you mind to submit a patch?

Thanks

@kftseng
Copy link
Author

kftseng commented Nov 12, 2022

diff --git a/src/IndexBuilder.php b/src/IndexBuilder.php
index 33a461d..8b8af56 100644
--- a/src/IndexBuilder.php
+++ b/src/IndexBuilder.php
@@ -54,7 +54,7 @@ class IndexBuilder

         $data = ['actions' => []];

-        $data['actions'][] = ['remove' => ['index' => '*', 'alias' => $indexName]];
+        $data['actions'][] = ['remove' => ['index' => $indexName . '*', 'alias' => $indexName]];
         $data['actions'][] = ['add' => ['index' => $index->getName(), 'alias' => $indexName]];

         return $this->client->request('_aliases', Request::POST, $data);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants