From 9315954f3ea250bb8447d3336aed14114075dfb1 Mon Sep 17 00:00:00 2001 From: Gargaj Date: Sat, 6 Sep 2014 01:20:20 +0200 Subject: [PATCH] Elasticsearch: check for valid mappings --- adminer/drivers/elastic.inc.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/adminer/drivers/elastic.inc.php b/adminer/drivers/elastic.inc.php index 397ca6b9..3aac8331 100644 --- a/adminer/drivers/elastic.inc.php +++ b/adminer/drivers/elastic.inc.php @@ -280,13 +280,15 @@ if (isset($_GET["elastic"])) { if (!$mappings) { $mappings = $result[$connection->_db]['mappings'][$table]['properties']; } - foreach ($mappings as $name => $field) { - $return[$name] = array( - "field" => $name, - "full_type" => $field["type"], - "type" => $field["type"], - "privileges" => array("insert" => 1, "select" => 1, "update" => 1), - ); + if ($mappings) { + foreach ($mappings as $name => $field) { + $return[$name] = array( + "field" => $name, + "full_type" => $field["type"], + "type" => $field["type"], + "privileges" => array("insert" => 1, "select" => 1, "update" => 1), + ); + } } } return $return;