]> git.joonet.de Git - adminer.git/commitdiff
Adapt to mapping structure
authorGargaj <gargaj@conspiracy.hu>
Mon, 23 Jun 2014 19:38:35 +0000 (21:38 +0200)
committerJakub Vrana <jakub@vrana.cz>
Thu, 3 Jul 2014 23:36:05 +0000 (16:36 -0700)
Mappings return a different structure actually:
http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/mapping-intro.html#_viewing_the_mapping

adminer/drivers/elastic.inc.php

index 6a143726d462c6d28e7ff288e3c4a91c248b0263..33da2d33ea79c71efe537eac4a6b8402a92d71a3 100644 (file)
@@ -269,10 +269,14 @@ if (isset($_GET["elastic"])) {
 
        function fields($table) {
                global $connection;
-               $mapping = $connection->query("$table/_mapping");
+               $result = $connection->query("$table/_mapping");
                $return = array();
-               if ($mapping) {
-                       foreach ($mapping[$table]['properties'] as $name => $field) {
+               if ($result) {
+                       $mappings = $result[$table]['properties'];
+                       if (!$mappings) {
+                               $mappings = $result[$connection->_db]['mappings'][$table]['properties'];
+                       }
+                       foreach ($mappings as $name => $field) {
                                $return[$name] = array(
                                        "field" => $name,
                                        "full_type" => $field["type"],