wangchuanjin 1 жил өмнө
parent
commit
2b4da3b281
1 өөрчлөгдсөн 3 нэмэгдсэн , 4 устгасан
  1. 3 4
      es/esv7.go

+ 3 - 4
es/esv7.go

@@ -179,7 +179,9 @@ func (e *EsV7) get(index, itype, searchType, query string, isLimit, isHighlight
 		total = searchResult.TotalHits()
 		if searchResult.Hits != nil {
 			resNum = len(searchResult.Hits.Hits)
-			if isLimit && resNum <= 5000 {
+			if isLimit && resNum > 5000 {
+				log.Println("查询结果太多,查询到:", resNum, "条")
+			} else {
 				res = make([]map[string]interface{}, resNum)
 				for i, hit := range searchResult.Hits.Hits {
 					//d := json.NewDecoder(bytes.NewBuffer(*hit.Source))
@@ -193,10 +195,7 @@ func (e *EsV7) get(index, itype, searchType, query string, isLimit, isHighlight
 						res[i]["highlight"] = map[string][]string(hit.Highlight)
 					}
 				}
-			} else {
-				log.Println("查询结果太多,查询到:", resNum, "条")
 			}
-
 		}
 	}
 	return total, resNum, &res