作者 邓超

es

@@ -215,7 +215,7 @@ class MailListV2Es extends Base { @@ -215,7 +215,7 @@ class MailListV2Es extends Base {
215 if(empty($where['flagged'])){ 215 if(empty($where['flagged'])){
216 $query['bool']['must'][] = $this->assignSql($folder); 216 $query['bool']['must'][] = $this->assignSql($folder);
217 }else{ 217 }else{
218 - $query['bool']['must'][] = $this->assignSql2(); 218 + $query['bool']['must'][] = $this->assignSql('收件箱');
219 } 219 }
220 220
221 logs('请求es前'); 221 logs('请求es前');
@@ -542,15 +542,8 @@ class MailListV2Es extends Base { @@ -542,15 +542,8 @@ class MailListV2Es extends Base {
542 */ 542 */
543 private function countFlagged($body){ 543 private function countFlagged($body){
544 $body['query']['bool']['must'][] = ['term'=>['flagged'=>1]]; 544 $body['query']['bool']['must'][] = ['term'=>['flagged'=>1]];
545 - $body['query']['bool']['must'][] = $this->assignSql2();  
546 - return $this->es->count($body,['aggs' => [  
547 - 'unique_udate' => [  
548 - 'terms' => [  
549 - 'field' => 'udate', // 替换为你的字段名称  
550 - 'size' => 500 // 设置返回的去重值的数量  
551 - ]  
552 - ]  
553 - ]]); 545 + $body['query']['bool']['must'][] = $this->assignSql('收件箱');
  546 + return $this->es->count($body);
554 } 547 }
555 548
556 } 549 }
@@ -94,17 +94,13 @@ class Es { @@ -94,17 +94,13 @@ class Es {
94 * @author:dc 94 * @author:dc
95 * @time 2025/3/4 9:47 95 * @time 2025/3/4 9:47
96 */ 96 */
97 - public function count(array $body,$other=[]){ 97 + public function count(array $body){
98 98
99 $params = [ 99 $params = [
100 'index' => $this->getIndex(), 100 'index' => $this->getIndex(),
101 'body' => $body 101 'body' => $body
102 ]; 102 ];
103 103
104 - if($other){  
105 - $params = array_merge($params,$other);  
106 - }  
107 -  
108 try { 104 try {
109 $response = $this->client->count($params); 105 $response = $this->client->count($params);
110 }catch (\Throwable $e) { 106 }catch (\Throwable $e) {