From b4a16368af158a3e76ab215323d42e263bedea44 Mon Sep 17 00:00:00 2001 From: like Date: Tue, 14 Nov 2023 21:49:07 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=91=8A=E8=AD=A6=E5=88=97=E8=A1=A8?= =?UTF-8?q?=EF=BC=8C=E5=85=B3=E9=94=AE=E8=AF=8D=E6=A8=A1=E7=B3=8A=E6=90=9C?= =?UTF-8?q?=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/service/alert.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/service/alert.go b/src/service/alert.go index 184fcac..dd17e81 100644 --- a/src/service/alert.go +++ b/src/service/alert.go @@ -426,11 +426,10 @@ func (a *AlertSvc) DocSearch(req request.ListAlert) (resp response.AlertList, er // 请输入预警点/分类/指标 if req.Keyword != "" { subBoolQuery := elastic.NewBoolQuery() - //subBoolQuery.Should(elastic.NewMultiMatchQuery(req.Keyword, "alert_point", "class_parent_name", "class_name", "metric_config_name")) - subBoolQuery.Should(elastic.NewPrefixQuery("alert_point.keyword", req.Keyword)) - subBoolQuery.Should(elastic.NewPrefixQuery("class_parent_name.keyword", req.Keyword)) - subBoolQuery.Should(elastic.NewPrefixQuery("class_name.keyword", req.Keyword)) - subBoolQuery.Should(elastic.NewPrefixQuery("metric_config_name.keyword", req.Keyword)) + subBoolQuery.Should(elastic.NewWildcardQuery("alert_point.keyword", fmt.Sprintf("*%s*", req.Keyword))) + subBoolQuery.Should(elastic.NewWildcardQuery("class_parent_name.keyword", fmt.Sprintf("*%s*", req.Keyword))) + subBoolQuery.Should(elastic.NewWildcardQuery("class_name.keyword", fmt.Sprintf("*%s*", req.Keyword))) + subBoolQuery.Should(elastic.NewWildcardQuery("metric_config_name.keyword", fmt.Sprintf("*%s*", req.Keyword))) boolQuery.Must(subBoolQuery) } -- 2.26.0