|
@ -196,6 +196,10 @@ func (the *ESHelper) BulkWrite(index, reqBody string) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (the *ESHelper) BulkWriteRaws2Es(index string, raws []models.EsRaw) { |
|
|
func (the *ESHelper) BulkWriteRaws2Es(index string, raws []models.EsRaw) { |
|
|
|
|
|
|
|
|
|
|
|
//log 测试用
|
|
|
|
|
|
const logTagDeviceId = "91da4d1f-fbc7-4dad-bedd-f8ff05c0e0e0" |
|
|
|
|
|
|
|
|
body := strings.Builder{} |
|
|
body := strings.Builder{} |
|
|
for _, raw := range raws { |
|
|
for _, raw := range raws { |
|
|
// scala => val id = UUID.nameUUIDFromBytes(s"${v.deviceId}-${v.acqTime.getMillis}".getBytes("UTF-8")).toString
|
|
|
// scala => val id = UUID.nameUUIDFromBytes(s"${v.deviceId}-${v.acqTime.getMillis}".getBytes("UTF-8")).toString
|
|
@ -206,6 +210,10 @@ func (the *ESHelper) BulkWriteRaws2Es(index string, raws []models.EsRaw) { |
|
|
%s |
|
|
%s |
|
|
`, index, _id, source) |
|
|
`, index, _id, source) |
|
|
body.WriteString(s) |
|
|
body.WriteString(s) |
|
|
|
|
|
|
|
|
|
|
|
if raw.IotaDevice == logTagDeviceId { |
|
|
|
|
|
log.Printf("BulkWriteRaws2Es 标记设备数据 [%s] %s ", logTagDeviceId, string(s)) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
the.BulkWrite(index, body.String()) |
|
|
the.BulkWrite(index, body.String()) |
|
|
|
|
|
|
|
|