mirror of
https://github.com/grafana/grafana.git
synced 2025-01-26 16:27:02 -06:00
Elasticsearch: Fix empty query request to send properly (#17488)
* ensure that empty Elasticsearch queries are properly set to *. Fixes issue that appears when passing raw data from variables. * combine null check and empty check into one
This commit is contained in:
parent
a2370a379d
commit
c78b6e2a67
@ -257,7 +257,11 @@ export class ElasticDatasource {
|
||||
target.alias = this.templateSrv.replace(target.alias, options.scopedVars, 'lucene');
|
||||
}
|
||||
|
||||
const queryString = this.templateSrv.replace(target.query || '*', options.scopedVars, 'lucene');
|
||||
let queryString = this.templateSrv.replace(target.query, options.scopedVars, 'lucene');
|
||||
// Elasticsearch queryString should always be '*' if empty string
|
||||
if (!queryString || queryString === '') {
|
||||
queryString = '*';
|
||||
}
|
||||
const queryObj = this.queryBuilder.build(target, adhocFilters, queryString);
|
||||
const esQuery = angular.toJson(queryObj);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user