diff --git a/src/plugins/kibana/public/settings/sections/indices/_indexed_fields.js b/src/plugins/kibana/public/settings/sections/indices/_indexed_fields.js index cebb4f10e6009..a60237aaba06c 100644 --- a/src/plugins/kibana/public/settings/sections/indices/_indexed_fields.js +++ b/src/plugins/kibana/public/settings/sections/indices/_indexed_fields.js @@ -3,7 +3,7 @@ define(function (require) { require('ui/paginated_table'); require('ui/modules').get('apps/settings') - .directive('indexedFields', function ($filter) { + .directive('indexedFields', function ($filter, config) { var yesTemplate = ''; var noTemplate = ''; var nameHtml = require('plugins/kibana/settings/sections/indices/_field_name.html'); @@ -24,6 +24,7 @@ define(function (require) { { title: 'format' }, { title: 'analyzed', info: 'Analyzed fields may require extra memory to visualize' }, { title: 'indexed', info: 'Fields that are not indexed are unavailable for search' }, + { title: 'exclude', info: 'Fields that are excluded from _source when it is fetched' }, { title: 'controls', sortable: false } ]; @@ -60,6 +61,10 @@ define(function (require) { markup: field.indexed ? yesTemplate : noTemplate, value: field.indexed }, + { + markup: field.exclude ? yesTemplate : noTemplate, + value: field.exclude + }, { markup: controlsHtml, scope: childScope diff --git a/src/plugins/kibana/server/lib/init_default_field_props.js b/src/plugins/kibana/server/lib/init_default_field_props.js index 0ec669ca5ac32..b7dfdb0204390 100644 --- a/src/plugins/kibana/server/lib/init_default_field_props.js +++ b/src/plugins/kibana/server/lib/init_default_field_props.js @@ -17,6 +17,7 @@ module.exports = function initDefaultFieldProps(fields) { analyzed: true, doc_values: false, scripted: false, + exclude: false, count: 0 }); @@ -27,6 +28,7 @@ module.exports = function initDefaultFieldProps(fields) { analyzed: false, doc_values: true, scripted: false, + exclude: false, count: 0 }); } @@ -36,6 +38,7 @@ module.exports = function initDefaultFieldProps(fields) { analyzed: false, doc_values: true, scripted: false, + exclude: false, count: 0 }); } diff --git a/src/testUtils/stub_index_pattern.js b/src/testUtils/stub_index_pattern.js index d350fa1254ca6..f0ad374dbd669 100644 --- a/src/testUtils/stub_index_pattern.js +++ b/src/testUtils/stub_index_pattern.js @@ -18,6 +18,7 @@ define(function (require) { this.timeFieldName = timeField; this.getNonScriptedFields = sinon.spy(); this.getScriptedFields = sinon.spy(); + this.getSourceFiltering = sinon.spy(); this.metaFields = ['_id', '_type', '_source']; this.fieldFormatMap = {}; this.routes = IndexPattern.prototype.routes; diff --git a/src/ui/public/doc_table/__tests__/doc_table.js b/src/ui/public/doc_table/__tests__/doc_table.js index 4ff421e86c804..091b45bd87124 100644 --- a/src/ui/public/doc_table/__tests__/doc_table.js +++ b/src/ui/public/doc_table/__tests__/doc_table.js @@ -71,6 +71,10 @@ describe('docTable', function () { expect($elem.text()).to.not.be.empty(); }); + it('should set the source filtering defintion', function () { + expect($scope.indexPattern.getSourceFiltering.called).to.be(true); + }); + it('should set the indexPattern to that of the searchSource', function () { expect($scope.indexPattern).to.be(searchSource.get('index')); }); diff --git a/src/ui/public/doc_table/doc_table.js b/src/ui/public/doc_table/doc_table.js index 4bebced3c9743..7344efc88b50b 100644 --- a/src/ui/public/doc_table/doc_table.js +++ b/src/ui/public/doc_table/doc_table.js @@ -81,6 +81,11 @@ define(function (require) { $scope.searchSource.size(config.get('discover:sampleSize')); $scope.searchSource.sort(getSort($scope.sorting, $scope.indexPattern)); + var sourceFiltering = $scope.indexPattern.getSourceFiltering($scope.columns); + if (sourceFiltering) { + $scope.searchSource.source(sourceFiltering); + } + // Set the watcher after initialization $scope.$watchCollection('sorting', function (newSort, oldSort) { // Don't react if sort values didn't really change diff --git a/src/ui/public/field_editor/field_editor.html b/src/ui/public/field_editor/field_editor.html index 18e065a6b7b6d..d7b74a224fba9 100644 --- a/src/ui/public/field_editor/field_editor.html +++ b/src/ui/public/field_editor/field_editor.html @@ -83,6 +83,38 @@
+ You cannot exclude metadata fields. +
++ If checked, this field will be filtered from the _source of each document using + source filtering. This only impacts views that fetch the _source for documents, like Discover or the doc table. +
++ If this field is explicitly selected in your saved search, then it will not be excluded. +
+