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) {
|
||||
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"],
|
||||
|
|
Loading…
Reference in a new issue