diff --git a/common/lib/shared.js b/common/lib/shared.js index 78f8989606e..146aeecc1f9 100644 --- a/common/lib/shared.js +++ b/common/lib/shared.js @@ -127,13 +127,14 @@ function top_field_values(docs,field,count) { }).reverse().slice(0,count) } -function add_to_query(original,field,value) { +function add_to_query(original,field,value,negate) { + var not = negate ? "NOT " : ""; if(value !== '') var query = field + ":" + "\"" + addslashes(value.toString()) + "\""; else var query = "_missing_:" + field; var glue = original != "" ? " AND " : ""; - return original + glue + query; + return original + glue + not + query; } /** * Calculate a graph interval diff --git a/panels/fields/micropanel.html b/panels/fields/micropanel.html index 4c7ca59e9a3..757e91f6844 100644 --- a/panels/fields/micropanel.html +++ b/panels/fields/micropanel.html @@ -13,10 +13,10 @@ - {{field[0]}} + {{{true: "__blank__",false:field[0]}[field[0] == ""]}} - + {{field[1]}} diff --git a/panels/fields/module.js b/panels/fields/module.js index 7ff0799ef3f..534ef8e5cd4 100644 --- a/panels/fields/module.js +++ b/panels/fields/module.js @@ -58,8 +58,8 @@ angular.module('kibana.fields', []) eventBus.broadcast($scope.$id,$scope.panel.group,"selected_fields",$scope.active) } - $scope.build_search = function(field, value) { - $scope.panel.query = add_to_query($scope.panel.query,field,value) + $scope.build_search = function(field, value,negate) { + $scope.panel.query = add_to_query($scope.panel.query,field,value,negate) eventBus.broadcast($scope.$id,$scope.panel.group,'query',$scope.panel.query); } diff --git a/panels/table/module.html b/panels/table/module.html index fb2b7d00c4c..2954058258f 100644 --- a/panels/table/module.html +++ b/panels/table/module.html @@ -39,7 +39,7 @@ {{key}} - + {{value}} diff --git a/panels/table/module.js b/panels/table/module.js index 5c03f2a4d7e..8c7313b243b 100644 --- a/panels/table/module.js +++ b/panels/table/module.js @@ -67,8 +67,8 @@ angular.module('kibana.table', []) $scope.get_data(); } - $scope.build_search = function(field, value) { - $scope.panel.query = add_to_query($scope.panel.query,field,value) + $scope.build_search = function(field, value,negate) { + $scope.panel.query = add_to_query($scope.panel.query,field,value,negate) $scope.panel.offset = 0; $scope.get_data(); eventBus.broadcast($scope.$id,$scope.panel.group,'query',$scope.panel.query);