]> git.joonet.de Git - adminer.git/commitdiff
Elasticsearch: Support dropping aliases
authorJakub Vrana <jakub@vrana.cz>
Wed, 11 Jun 2025 06:45:21 +0000 (08:45 +0200)
committerJakub Vrana <jakub@vrana.cz>
Wed, 11 Jun 2025 06:45:21 +0000 (08:45 +0200)
CHANGELOG.md
plugins/drivers/elastic.php

index 002fba8b6db1a6cb0111bd6b9ed834396e9b7efc..02f2838015208ff5c114a794f38a2fb9b5752613 100644 (file)
@@ -8,6 +8,7 @@
 - PostgreSQL: Add SQL operator to select
 - PostgreSQL: Hide only partitions, not all inherited tables from menu
 - PostgreSQL 11-: Avoid duplicate oid in table status (bug #1089)
+- Elasticsearch: Support dropping aliases
 - Plugins: Methods processList() and killProcess()
 
 ## Adminer 5.3.0 (released 2025-05-04)
index e07a2a825768c07c3a696a35a0bea11a65e4bde9..726176260ee67a3aa5f0d6aa197f57f04d9af08d 100644 (file)
@@ -529,15 +529,18 @@ if (isset($_GET["elastic"])) {
                }
        }
 
-       /** Drop types
-        * @param list<string> $tables
-        */
+       function drop_views(array $tables): bool {
+               $return = connection()->rootQuery('_aliases', array('actions' => array_map(function ($table) {
+                       return array('remove' => array('index' => '*', 'alias' => $table));
+               }, $tables)), 'POST');
+               return $return && !$return['errors'];
+       }
+
        function drop_tables(array $tables): bool {
                $return = true;
                foreach ($tables as $table) { //! convert to bulk api
                        $return = $return && connection()->rootQuery(urlencode($table), null, 'DELETE');
                }
-
                return $return;
        }