Commit b4a16368 authored by 李科's avatar 李科

perf: 告警列表,关键词模糊搜索

parent b7669d9d
...@@ -426,11 +426,10 @@ func (a *AlertSvc) DocSearch(req request.ListAlert) (resp response.AlertList, er ...@@ -426,11 +426,10 @@ func (a *AlertSvc) DocSearch(req request.ListAlert) (resp response.AlertList, er
// 请输入预警点/分类/指标 // 请输入预警点/分类/指标
if req.Keyword != "" { if req.Keyword != "" {
subBoolQuery := elastic.NewBoolQuery() subBoolQuery := elastic.NewBoolQuery()
//subBoolQuery.Should(elastic.NewMultiMatchQuery(req.Keyword, "alert_point", "class_parent_name", "class_name", "metric_config_name")) subBoolQuery.Should(elastic.NewWildcardQuery("alert_point.keyword", fmt.Sprintf("*%s*", req.Keyword)))
subBoolQuery.Should(elastic.NewPrefixQuery("alert_point.keyword", req.Keyword)) subBoolQuery.Should(elastic.NewWildcardQuery("class_parent_name.keyword", fmt.Sprintf("*%s*", req.Keyword)))
subBoolQuery.Should(elastic.NewPrefixQuery("class_parent_name.keyword", req.Keyword)) subBoolQuery.Should(elastic.NewWildcardQuery("class_name.keyword", fmt.Sprintf("*%s*", req.Keyword)))
subBoolQuery.Should(elastic.NewPrefixQuery("class_name.keyword", req.Keyword)) subBoolQuery.Should(elastic.NewWildcardQuery("metric_config_name.keyword", fmt.Sprintf("*%s*", req.Keyword)))
subBoolQuery.Should(elastic.NewPrefixQuery("metric_config_name.keyword", req.Keyword))
boolQuery.Must(subBoolQuery) boolQuery.Must(subBoolQuery)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment