fix: total in histogram response of events search

This commit is contained in:
junotx
2020-06-19 16:20:17 +08:00
parent 0493a352dc
commit 217dd4f713

View File

@@ -108,7 +108,7 @@ func (es *Elasticsearch) CountOverTime(filter *events.Filter, interval string) (
if err := json.Unmarshal(raw, &agg); err != nil {
return nil, err
}
histo := events.Histogram{Total: int64(len(agg.Buckets))}
histo := events.Histogram{Total: resp.Hits.Total}
for _, b := range agg.Buckets {
histo.Buckets = append(histo.Buckets,
events.Bucket{Time: b.Key, Count: b.DocCount})