From 6d8545da63f05498fb62904e430e38cb9fe38c00 Mon Sep 17 00:00:00 2001 From: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com> Date: Fri, 10 Jul 2020 17:04:05 +0200 Subject: [PATCH] Elastic: Fix error "e.buckets[Symbol.iterator] is not a function" when using filter (#26217) * Add bucket to array if it is not in array * Fix issue one level above * Rename variable * Move array check to processAggregationDocs --- .../app/plugins/datasource/elasticsearch/elastic_response.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/datasource/elasticsearch/elastic_response.ts b/public/app/plugins/datasource/elasticsearch/elastic_response.ts index 0dee3d727ac..bb06b2b0537 100644 --- a/public/app/plugins/datasource/elasticsearch/elastic_response.ts +++ b/public/app/plugins/datasource/elasticsearch/elastic_response.ts @@ -135,8 +135,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)) {