Commit 9de016bf by Torkel Ödegaard

feat(elasticseach): alias and lucene query fields are now visible/usable when…

feat(elasticseach): alias and lucene query fields are now visible/usable when using raw json query, #1034
parent 3eddfc02
......@@ -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'}],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment