Browse Source

update 添加 es 写入返回纪录

pull/2/head
lucas 2 months ago
parent
commit
5c95f682a5
  1. 6
      dbHelper/elasticsearchHelper.go

6
dbHelper/elasticsearchHelper.go

@ -185,13 +185,13 @@ func (the *ESHelper) BulkWrite(index, reqBody string) {
defer res.Body.Close()
if err != nil {
log.Panicf("es 写入[%s],err=%s", index, err.Error())
return
}
respBody, _ := io.ReadAll(res.Body)
if res.StatusCode != 200 && res.StatusCode != 201 {
respBody, _ := io.ReadAll(res.Body)
log.Panicf("es 写入失败,err=%s \n body=%s", string(respBody), reqBody)
}
//log.Printf("es 写入[%s],字符长度=%d,完成", index, len(reqBody))
log.Printf("es 写入[%s],完成,res=%s ", index, reqBody)
}

Loading…
Cancel
Save