Mappings return a different structure actually:
http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/mapping-intro.html#_viewing_the_mapping
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"],