Elasticsearch: fix select when fields are explicit

If fields are explicitly said, ES returns each row as an array.
This commit is contained in:
Gargaj 2014-09-06 02:14:01 +02:00 committed by Jakub Vrana
parent c38f25b5d6
commit 02e574c8e9

View file

@ -158,6 +158,9 @@ if (isset($_GET["elastic"])) {
}
}
foreach ($fields as $key => $val) {
if ($data["fields"]) {
$val = $val[0];
}
$row[$key] = (is_array($val) ? json_encode($val) : $val); //! display JSON and others differently
}
$return[] = $row;