mirror of
https://github.com/grafana/grafana.git
synced 2025-01-26 08:16:59 -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];
|
target = options.targets[i];
|
||||||
if (target.hide) {return;}
|
if (target.hide) {return;}
|
||||||
|
|
||||||
var esQuery = this.queryBuilder.build(target);
|
var esQuery = angular.toJson(this.queryBuilder.build(target));
|
||||||
payload += header + '\n';
|
esQuery = esQuery.replace("$lucene_query", target.query || '*');
|
||||||
payload += angular.toJson(esQuery) + '\n';
|
|
||||||
|
|
||||||
|
payload += header + '\n' + esQuery + '\n';
|
||||||
sentTargets.push(target);
|
sentTargets.push(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</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">
|
<li class="tight-form-item query-keyword" style="width: 75px">
|
||||||
Query
|
Query
|
||||||
</li>
|
</li>
|
||||||
|
@ -67,7 +67,7 @@ function (angular) {
|
|||||||
"query": {
|
"query": {
|
||||||
"query_string": {
|
"query_string": {
|
||||||
"analyze_wildcard": true,
|
"analyze_wildcard": true,
|
||||||
"query": target.query || '*' ,
|
"query": '$lucene_query',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"filter": {
|
"filter": {
|
||||||
|
@ -21,6 +21,14 @@ define([
|
|||||||
expect(query.aggs["1"].date_histogram.extended_bounds.min).to.be("$timeFrom");
|
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() {
|
it('with multiple bucket aggs', function() {
|
||||||
var query = builder.build({
|
var query = builder.build({
|
||||||
metrics: [{type: 'count', id: '1'}],
|
metrics: [{type: 'count', id: '1'}],
|
||||||
|
Loading…
Reference in New Issue
Block a user