diff --git a/public/app/plugins/datasource/elasticsearch/elastic_response.ts b/public/app/plugins/datasource/elasticsearch/elastic_response.ts index 11b78c523db..2643afed23b 100644 --- a/public/app/plugins/datasource/elasticsearch/elastic_response.ts +++ b/public/app/plugins/datasource/elasticsearch/elastic_response.ts @@ -134,8 +134,8 @@ export class ElasticResponse { table.addColumn({ text: metricName }); values.push(value); }; - - for (const bucket of esAgg.buckets) { + const buckets = _.isArray(esAgg.buckets) ? esAgg.buckets : [esAgg.buckets]; + for (const bucket of buckets) { const values = []; for (const propValues of _.values(props)) {