From 0c09b298aa4450e207bec3f5b97956589e69e4f4 Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 27 Dec 2021 10:41:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=90=9C=E7=B4=A2=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/search.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/routers/search.go b/routers/search.go index 5c1535a9c..6bb8e10f9 100644 --- a/routers/search.go +++ b/routers/search.go @@ -43,7 +43,9 @@ func Search(ctx *context.Context) { boolQ := elastic.NewBoolQuery() nameQuery := elastic.NewMatchQuery("name", Key).Boost(2) descriptionQuery := elastic.NewMatchQuery("description", Key).Boost(1) + owner_idQuery := elastic.NewTermQuery("owner_id", 3) boolQ.Should(nameQuery, descriptionQuery) + boolQ.Must(owner_idQuery) res, err := client.Search(TableName + "-es-index").Query(boolQ).Do(ctx.Req.Context()) if err == nil { ctx.JSON(200, res)