diff --git a/src/service/alert.go b/src/service/alert.go index 184fcac16d347a2f760afd7d873dd38d28106c60..dd17e81146d9ab11c38d8032b682ac508759601a 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) }