From 250e3546595a3e21457b48d658e54680cdd9aaf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 1 Feb 2014 09:49:57 +0100 Subject: [PATCH] Dashboard search fix, only query against title field (Closes #51,Fixes #24) --- src/app/services/dashboard.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/app/services/dashboard.js b/src/app/services/dashboard.js index 71d55d120e5..942c1a64f0a 100644 --- a/src/app/services/dashboard.js +++ b/src/app/services/dashboard.js @@ -385,14 +385,12 @@ function (angular, $, kbn, _, config, moment, Modernizr) { ); }; - this.elasticsearch_list = function(query,count) { + this.elasticsearch_list = function(query, count) { var request = ejs.Request().indices(config.grafana_index).types('dashboard'); - var q = null; - if(config.elasticsearch_all_disabled==true){ - q = ('title:' + (query || '*')) - }else{ - q = (query || '*') - } + // if elasticsearch has disabled _all field we need + // need to specifiy field here + var q = 'title:' + (query || '*'); + return request.query( ejs.QueryStringQuery(q) ).size(count).doSearch(