正在显示
2 个修改的文件
包含
13 行增加
和
2 行删除
@@ -543,7 +543,14 @@ class MailListV2Es extends Base { | @@ -543,7 +543,14 @@ class MailListV2Es extends Base { | ||
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(); | 545 | $body['query']['bool']['must'][] = $this->assignSql2(); |
546 | - return $this->es->count($body); | 546 | + return $this->es->count($body,['aggs' => [ |
547 | + 'unique_udate' => [ | ||
548 | + 'terms' => [ | ||
549 | + 'field' => 'udate', // 替换为你的字段名称 | ||
550 | + 'size' => 500 // 设置返回的去重值的数量 | ||
551 | + ] | ||
552 | + ] | ||
553 | + ]]); | ||
547 | } | 554 | } |
548 | 555 | ||
549 | } | 556 | } |
@@ -94,13 +94,17 @@ class Es { | @@ -94,13 +94,17 @@ 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){ | 97 | + public function count(array $body,$other=[]){ |
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 | + | ||
104 | try { | 108 | try { |
105 | $response = $this->client->count($params); | 109 | $response = $this->client->count($params); |
106 | }catch (\Throwable $e) { | 110 | }catch (\Throwable $e) { |
-
请 注册 或 登录 后发表评论