From 6d903ff16054f6fb1c03a7341b9ad7337fc2e17a Mon Sep 17 00:00:00 2001 From: liuxiaolong <736321739@qq.com> Date: 星期四, 04 七月 2019 15:11:16 +0800 Subject: [PATCH] fix es query bug --- controllers/dbtableperson.go | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/controllers/dbtableperson.go b/controllers/dbtableperson.go index 1c30882..0e9e2fa 100644 --- a/controllers/dbtableperson.go +++ b/controllers/dbtableperson.go @@ -209,7 +209,7 @@ if tableId == "all" || tableId == "" { // / 鎵�鏈変汉鍛� } else { - syncTerm = ",{\"term\":{\"tableId\":\"" + tableId + "\"}}" // 搴曞簱浜哄憳 + syncTerm = "{\"term\":{\"tableId\":\"" + tableId + "\"}}" // 搴曞簱浜哄憳 } if contentValue != "" { contentParam = ",\"must\":[{\"multi_match\":{\"query\":\"" + contentValue + "\",\"type\":\"best_fields\"," + @@ -280,7 +280,7 @@ if tableId == "all" || tableId == "" { // / 鎵�鏈変汉鍛� } else { - syncTerm = ",{\"term\":{\"tableId\":\"" + tableId + "\"}}" // 搴曞簱浜哄憳 + syncTerm = "{\"term\":{\"tableId\":\"" + tableId + "\"}}" // 搴曞簱浜哄憳 } if orderType == "desc" { orderType = "desc" @@ -288,8 +288,10 @@ orderType = "asc" } - params := "{\"query\":{\"bool\":{\"filter\":[" + - "{\"term\":{\"isDelete\":\"0\"}}" + syncTerm + "]" + contentParam + "}},\"from\":" + strconv.Itoa(from) + ",\"size\":" + strconv.Itoa(size) + ",\"sort\":{\"" + orderName + "\":{\"order\":\"" + orderType + "\"}}}" + //params := "{\"query\":{\"bool\":{\"filter\":[" + + // "{\"term\":{\"isDelete\":\"0\"}}" + syncTerm + "]" + contentParam + "}},\"from\":" + strconv.Itoa(from) + ",\"size\":" + strconv.Itoa(size) + ",\"sort\":{\"" + orderName + "\":{\"order\":\"" + orderType + "\"}}}" + params := "{\"query\":{\"bool\":{\"must_not\":[" + + "{\"term\":{\"isDelete\":\"1\"}}],\"filter\":[" + syncTerm + "]" + contentParam + "}},\"from\":" + strconv.Itoa(from) + ",\"size\":" + strconv.Itoa(size) + ",\"sort\":{\"" + orderName + "\":{\"order\":\"" + orderType + "\"}}}" fmt.Print("璇锋眰url:%s;\n 璇锋眰鍙傛暟params:%s", url, params) data := esutil.GetEsDataReq(url, params, true) featByte := make([]byte, 0, 1024) -- Gitblit v1.8.0