diff --git a/public/app/plugins/datasource/elasticsearch/query_ctrl.ts b/public/app/plugins/datasource/elasticsearch/query_ctrl.ts index 85e8158734f..fa5831c8c4e 100644 --- a/public/app/plugins/datasource/elasticsearch/query_ctrl.ts +++ b/public/app/plugins/datasource/elasticsearch/query_ctrl.ts @@ -51,9 +51,15 @@ export class ElasticQueryCtrl extends QueryCtrl { } queryUpdated() { + // As Raw Data and Raw Document have the same request, we need to run refresh if they are updated + const isPossiblyRawDataSwitch = this.target.metrics.some( + (metric: any) => metric.type === 'raw_data' || metric.type === 'raw_document' + ); const newJson = angular.toJson(this.datasource.queryBuilder.build(this.target), true); if (this.rawQueryOld && newJson !== this.rawQueryOld) { this.refresh(); + } else if (isPossiblyRawDataSwitch) { + this.refresh(); } this.rawQueryOld = newJson;