diff --git a/CHANGELOG.md b/CHANGELOG.md index 18650d9ac..8c74f3284 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ NOTE: As semantic versioning states all 0.y.z releases can contain breaking chan - [#186](https://github.com/kobsio/kobs/pull/186): [jaeger] Fix tooltip position in traces chart. - [#189](https://github.com/kobsio/kobs/pull/189): [clickhouse] Fix download of `.csv` fiels. - [#191](https://github.com/kobsio/kobs/pull/191): [clickhouse] Fix returned logs, when user selected a custom order. +- [#196](https://github.com/kobsio/kobs/pull/196): [elasticsearch] Fix number of documents. ### Changed diff --git a/plugins/elasticsearch/pkg/instance/instance.go b/plugins/elasticsearch/pkg/instance/instance.go index 82d06abb5..7e584b0fe 100644 --- a/plugins/elasticsearch/pkg/instance/instance.go +++ b/plugins/elasticsearch/pkg/instance/instance.go @@ -68,9 +68,14 @@ func (i *Instance) GetLogs(ctx context.Context, query string, timeStart, timeEnd return nil, err } + var hits int64 + for _, bucket := range res.Aggregations.LogCount.Buckets { + hits = hits + bucket.DocCount + } + data := &Data{ Took: res.Took, - Hits: res.Hits.Total.Value, + Hits: hits, Documents: res.Hits.Hits, Buckets: res.Aggregations.LogCount.Buckets, }