diff --git a/dbOperate/elasticsearchHelper.go b/dbOperate/elasticsearchHelper.go index 22d49ae..08d9921 100644 --- a/dbOperate/elasticsearchHelper.go +++ b/dbOperate/elasticsearchHelper.go @@ -281,10 +281,11 @@ func (the *ESHelper) BulkWriteRaws2Es(index string, raws []models.EsRaw, logIds %s `, index, _id, source) body.WriteString(s) - - if raw.IotaDevice == logIds[0] { - log.Printf("BulkWriteRaws2Es 标记设备数据 [%s] %s ", raw.IotaDevice, s) - logTag = true + if len(logIds) > 0 { + if raw.IotaDevice == logIds[0] { + log.Printf("BulkWriteRaws2Es 标记设备数据 [%s] %s ", raw.IotaDevice, s) + logTag = true + } } } if logTag { //追踪数据