mirror of
https://github.com/grafana/grafana.git
synced 2025-01-24 23:37:01 -06:00
feat(elasticseach): alias and lucene query fields are now visible/usable when using raw json query, #1034
This commit is contained in:
parent
3eddfc028e
commit
9de016bfe3
@ -158,10 +158,10 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes
|
||||
target = options.targets[i];
|
||||
if (target.hide) {return;}
|
||||
|
||||
var esQuery = this.queryBuilder.build(target);
|
||||
payload += header + '\n';
|
||||
payload += angular.toJson(esQuery) + '\n';
|
||||
var esQuery = angular.toJson(this.queryBuilder.build(target));
|
||||
esQuery = esQuery.replace("$lucene_query", target.query || '*');
|
||||
|
||||
payload += header + '\n' + esQuery + '\n';
|
||||
sentTargets.push(target);
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="tight-form-list" ng-hide="target.rawQuery">
|
||||
<ul class="tight-form-list">
|
||||
<li class="tight-form-item query-keyword" style="width: 75px">
|
||||
Query
|
||||
</li>
|
||||
|
@ -67,7 +67,7 @@ function (angular) {
|
||||
"query": {
|
||||
"query_string": {
|
||||
"analyze_wildcard": true,
|
||||
"query": target.query || '*' ,
|
||||
"query": '$lucene_query',
|
||||
}
|
||||
},
|
||||
"filter": {
|
||||
|
@ -21,6 +21,14 @@ define([
|
||||
expect(query.aggs["1"].date_histogram.extended_bounds.min).to.be("$timeFrom");
|
||||
});
|
||||
|
||||
it('with raw query', function() {
|
||||
var query = builder.build({
|
||||
rawQuery: '{"query": "$lucene_query"}',
|
||||
});
|
||||
|
||||
expect(query.query).to.be("$lucene_query");
|
||||
});
|
||||
|
||||
it('with multiple bucket aggs', function() {
|
||||
var query = builder.build({
|
||||
metrics: [{type: 'count', id: '1'}],
|
||||
|
Loading…
Reference in New Issue
Block a user