Adapt to mapping structure
Mappings return a different structure actually: http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/mapping-intro.html#_viewing_the_mapping
This commit is contained in:
parent
f80b296a1a
commit
04356ca0b0
|
@ -269,10 +269,14 @@ if (isset($_GET["elastic"])) {
|
||||||
|
|
||||||
function fields($table) {
|
function fields($table) {
|
||||||
global $connection;
|
global $connection;
|
||||||
$mapping = $connection->query("$table/_mapping");
|
$result = $connection->query("$table/_mapping");
|
||||||
$return = array();
|
$return = array();
|
||||||
if ($mapping) {
|
if ($result) {
|
||||||
foreach ($mapping[$table]['properties'] as $name => $field) {
|
$mappings = $result[$table]['properties'];
|
||||||
|
if (!$mappings) {
|
||||||
|
$mappings = $result[$connection->_db]['mappings'][$table]['properties'];
|
||||||
|
}
|
||||||
|
foreach ($mappings as $name => $field) {
|
||||||
$return[$name] = array(
|
$return[$name] = array(
|
||||||
"field" => $name,
|
"field" => $name,
|
||||||
"full_type" => $field["type"],
|
"full_type" => $field["type"],
|
||||||
|
|
Loading…
Reference in a new issue