kobe6258 пре 7 месеци
родитељ
комит
bb23bf0030
2 измењених фајлова са 3 додато и 3 уклоњено
  1. 2 2
      common/component/es/es.go
  2. 1 1
      domian/report/report_service.go

+ 2 - 2
common/component/es/es.go

@@ -466,10 +466,10 @@ func (es *ESClient) Delete(indexName string, id int) bool {
 
 }
 
-func (es *ESClient) Exist(docId int) (exist bool, err error) {
+func (es *ESClient) Exist(indexName string, docId int) (exist bool, err error) {
 
 	getRequest := esapi.GetRequest{
-		Index:      "my_index",
+		Index:      indexName,
 		DocumentID: strconv.Itoa(docId),
 	}
 	// 执行请求

+ 1 - 1
domian/report/report_service.go

@@ -378,7 +378,7 @@ func syncESAndSendMessage(reports []reportDao.Report) (err error) {
 	//同步es
 	for _, report := range reports {
 		var exist bool
-		exist, err = elastic().Exist(report.ID)
+		exist, err = elastic().Exist(htConfig.GetReportIndex(), report.ID)
 		if err != nil {
 			logger.Error("查询es失败,reportId::%d,err:%v", report.ID, err)
 		}