show elasticsearch query time
[phinde.git] / www / index.php
index 257ad87c99ec7c5a92dac9e57e1590ad09f2eeab..498cf93eb7b8900f87b628ae3f4644885b485110 100644 (file)
@@ -54,8 +54,10 @@ function buildLink($baseLink, $filters, $addFilterType, $addFilterValue)
     return $baseLink;
 }
 
+$timeBegin = microtime(true);
 $es = new Elasticsearch($GLOBALS['phinde']['elasticsearch']);
 $res = $es->search($query, $filters, $page, $perPage);
+$timeEnd = microtime(true);
 
 $pager = new Html_Pager(
     $res->hits->total, $perPage, $page + 1,
@@ -84,6 +86,7 @@ foreach ($res->aggregations as $key => &$aggregation) {
 render(
     'search',
     array(
+        'queryTime' => round($timeEnd - $timeBegin, 2) . 'ms',
         'query' => $query,
         'hitcount' => $res->hits->total,
         'hits' => $res->hits->hits,