|
|
@@ -43,9 +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) |
|
|
|
//owner_idQuery := elastic.NewTermQuery("owner_id", 3) |
|
|
|
boolQ.Should(nameQuery, descriptionQuery) |
|
|
|
boolQ.Must(owner_idQuery) |
|
|
|
//boolQ.Must(owner_idQuery) |
|
|
|
res, err := client.Search(TableName + "-es-index").Query(boolQ).Do(ctx.Req.Context()) |
|
|
|
if err == nil { |
|
|
|
ctx.JSON(200, res) |
|
|
|