ElasticSearch: table_statuses() also return count of rows
This commit is contained in:
parent
ee124dadb1
commit
3ac662c755
|
@ -224,10 +224,24 @@ if (isset($_GET["elastic"])) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function table_status($name = "", $fast = false) {
|
function table_status($name = "", $fast = false) {
|
||||||
$return = tables_list();
|
global $connection;
|
||||||
if ($return) {
|
$search = $connection->query("_search?search_type=count", array(
|
||||||
foreach ($return as $key => $type) { // _stats have just info about database
|
"facets" => array(
|
||||||
$return[$key] = array("Name" => $key, "Engine" => $type);
|
"count_by_type" => array(
|
||||||
|
"terms" => array(
|
||||||
|
"field" => "_type"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
), "POST");
|
||||||
|
$return = array();
|
||||||
|
if ($search) {
|
||||||
|
foreach ($search["facets"]["count_by_type"]["terms"] as $table) {
|
||||||
|
$return[$table["term"]] = array(
|
||||||
|
"Name" => $table["term"],
|
||||||
|
"Engine" => "table",
|
||||||
|
"Rows" => $table["count"]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if ($name != "") {
|
if ($name != "") {
|
||||||
return $return[$name];
|
return $return[$name];
|
||||||
|
|
Loading…
Reference in a new issue