Browse Source

es 结果判断

wangshan 5 months ago
parent
commit
913f4e49f3
1 changed files with 3 additions and 0 deletions
  1. 3 0
      marketanalysis/marketanalysis.go

+ 3 - 0
marketanalysis/marketanalysis.go

@@ -1217,6 +1217,9 @@ func (a *AnalysisEntity) ProjectTop10() (rMap map[string]interface{}, err error)
 	finalSql := fmt.Sprintf(a.GetCommonQuerySql(), queryTop10)
 	log.Println("ProjectTop10:", finalSql)
 	hits := elastic.Get(PtIndex, PtType, finalSql)
+	if hits == nil || len(*hits) == 0 {
+		return
+	}
 	rMap = map[string]interface{}{}
 	bArr := []map[string]interface{}{}
 	source := *hits