From 5d47a57b16422c189fb231ec080eac545427ae10 Mon Sep 17 00:00:00 2001 From: lucas Date: Fri, 22 Aug 2025 11:26:36 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E6=B7=BB=E5=8A=A0=20=20logIds=20?= =?UTF-8?q?=E4=BF=9D=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dbOperate/elasticsearchHelper.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 { //追踪数据