sunty
2020-08-20 7b6d324ced5d7fb96d693bf1af9c538cc9397da1
EsClient.go
@@ -476,7 +476,7 @@
   return tmpinfos
}
func SourceAggregations(buf [] byte) (sources map[string]interface{}, err error) {
func SourceAggregations(buf [] byte, thresholdTime float64) (sources map[string]interface{}, err error) {
   s := make(map[string]interface{})
   loc, err := time.LoadLocation("Asia/Shanghai")
   if err != nil {
@@ -531,7 +531,7 @@
         eTime := tmpTime
         if startTime != "" {
            sinTime, _ := time.ParseInLocation("2006-01-02 15:04:05", startTime, loc)
            if math.Abs(sinTime.Sub(mTime).Seconds()) <= 20 {
            if math.Abs(sinTime.Sub(mTime).Seconds()) <= thresholdTime {
               startTime = tmpTime
               hitsSources[len(hitsSources)-1]["endTime"] = tmpTime
               continue