diff --git a/src/app/panels/table/module.html b/src/app/panels/table/module.html
index 9913c3f00c5..1790b188c3a 100644
--- a/src/app/panels/table/module.html
+++ b/src/app/panels/table/module.html
@@ -19,6 +19,12 @@
+
+ Note These fields have been
+ extracted from your mapping.
+ Not all fields may be available
+ in your source document.
+
-
diff --git a/src/app/panels/terms/module.js b/src/app/panels/terms/module.js
index fe767360f22..fa19b021cf5 100644
--- a/src/app/panels/terms/module.js
+++ b/src/app/panels/terms/module.js
@@ -22,7 +22,7 @@ function (angular, app, _, $, kbn) {
var module = angular.module('kibana.panels.terms', []);
app.useModule(module);
- module.controller('terms', function($scope, querySrv, dashboard, filterSrv) {
+ module.controller('terms', function($scope, querySrv, dashboard, filterSrv, fields) {
$scope.panelMeta = {
modals : [
{
@@ -134,6 +134,9 @@ function (angular, app, _, $, kbn) {
boolQuery,
queries;
+ $scope.field = _.contains(fields.list,$scope.panel.field+'.raw') ?
+ $scope.panel.field+'.raw' : $scope.panel.field;
+
request = $scope.ejs.Request().indices(dashboard.indices);
$scope.panel.queries.ids = querySrv.idsByMode($scope.panel.queries);
@@ -145,11 +148,10 @@ function (angular, app, _, $, kbn) {
boolQuery = boolQuery.should(querySrv.toEjsObj(q));
});
-
// Terms mode
request = request
.facet($scope.ejs.TermsFacet('terms')
- .field($scope.panel.field)
+ .field($scope.field)
.size($scope.panel.size)
.order($scope.panel.order)
.exclude($scope.panel.exclude)
@@ -187,10 +189,10 @@ function (angular, app, _, $, kbn) {
$scope.build_search = function(term,negate) {
if(_.isUndefined(term.meta)) {
- filterSrv.set({type:'terms',field:$scope.panel.field,value:term.label,
+ filterSrv.set({type:'terms',field:$scope.field,value:term.label,
mandate:(negate ? 'mustNot':'must')});
} else if(term.meta === 'missing') {
- filterSrv.set({type:'exists',field:$scope.panel.field,
+ filterSrv.set({type:'exists',field:$scope.field,
mandate:(negate ? 'must':'mustNot')});
} else {
return;
diff --git a/src/app/services/fields.js b/src/app/services/fields.js
index b80821143f8..c3597cf2cc2 100644
--- a/src/app/services/fields.js
+++ b/src/app/services/fields.js
@@ -28,7 +28,6 @@ function (angular, _, config) {
self.indices = _.union(self.indices,_.keys(result));
self.list = mapFields(result);
});
- // Otherwise just use the cached mapping
}
}
});
@@ -76,13 +75,18 @@ function (angular, _, config) {
dot = (prefix) ? '.':'',
ret = {};
for(var attr in obj){
+ if(attr === 'dynamic_templates' || attr === '_default_') {
+ continue;
+ }
// For now only support multi field on the top level
// and if there is a default field set.
if(obj[attr]['type'] === 'multi_field') {
ret[attr] = obj[attr]['fields'][attr] || obj[attr];
- continue;
- }
- if (attr === 'properties') {
+ var keys = _.without(_.keys(obj[attr]['fields']),attr);
+ for(var key in keys) {
+ ret[attr+'.'+keys[key]] = obj[attr]['fields'][keys[key]];
+ }
+ } else if (attr === 'properties') {
_.extend(ret,flatten(obj[attr], propName));
} else if(typeof obj[attr] === 'object'){
_.extend(ret,flatten(obj[attr], propName + dot + attr));