| 
...
 | 
...
 | 
@@ -82,7 +82,9 @@ class Es { | 
| 
 | 
 | 
         }
 | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
         try {
 | 
| 
 | 
 | 
             $staTime = microtime(true);
 | 
| 
 | 
 | 
             $response = $this->client->search($params);
 | 
| 
 | 
 | 
             $this->timeLog($staTime);
 | 
| 
 | 
 | 
         }catch (\Throwable $e) {
 | 
| 
 | 
 | 
             logs("搜索数据es:".$e->getMessage()." \n ".json_encode($params)."\n".$e->getTraceAsString());
 | 
| 
 | 
 | 
             return [];
 | 
| 
...
 | 
...
 | 
@@ -92,6 +94,13 @@ class Es { | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
     }
 | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
     private function timeLog($staTime){
 | 
| 
 | 
 | 
         $endTime = microtime(true);
 | 
| 
 | 
 | 
         if($endTime-$staTime >= 2){
 | 
| 
 | 
 | 
             logs('查询es耗时:'.($endTime-$staTime).'s');
 | 
| 
 | 
 | 
         }
 | 
| 
 | 
 | 
     }
 | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
     /**
 | 
| 
 | 
 | 
      * 统计数量
 | 
| 
 | 
 | 
      * @param array $body
 | 
| 
...
 | 
...
 | 
@@ -106,7 +115,9 @@ class Es { | 
| 
 | 
 | 
         ];
 | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
         try {
 | 
| 
 | 
 | 
             $staTime = microtime(true);
 | 
| 
 | 
 | 
             $response = $this->client->count($params);
 | 
| 
 | 
 | 
             $this->timeLog($staTime);
 | 
| 
 | 
 | 
         }catch (\Throwable $e) {
 | 
| 
 | 
 | 
             logs("搜索数据es:".$e->getMessage()." \n ".json_encode($params)."\n".$e->getTraceAsString());
 | 
| 
 | 
 | 
             return 0;
 | 
...
 | 
...
 | 
 |