feat(elasticseach): alias and lucene query fields are now visible/usable when using raw json query, #1034

This commit is contained in:
Torkel Ödegaard 2015-09-21 12:07:03 +02:00
parent 3eddfc028e
commit 9de016bfe3
4 changed files with 13 additions and 5 deletions

View File

@ -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);
}

View File

@ -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>

View File

@ -67,7 +67,7 @@ function (angular) {
"query": {
"query_string": {
"analyze_wildcard": true,
"query": target.query || '*' ,
"query": '$lucene_query',
}
},
"filter": {

View File

@ -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'}],