Elasticsearch: fix select when fields are explicit
If fields are explicitly said, ES returns each row as an array.
This commit is contained in:
parent
c38f25b5d6
commit
02e574c8e9
|
@ -158,6 +158,9 @@ if (isset($_GET["elastic"])) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach ($fields as $key => $val) {
|
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
|
$row[$key] = (is_array($val) ? json_encode($val) : $val); //! display JSON and others differently
|
||||||
}
|
}
|
||||||
$return[] = $row;
|
$return[] = $row;
|
||||||
|
|
Loading…
Reference in a new issue