Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/core_plugins/kibana/public/doc/controllers/doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ app.controller('doc', function ($scope, $route, es, timefilter) {
}
},
stored_fields: computedFields.storedFields,
_source: computedFields._source,
_source: true,
script_fields: computedFields.scriptFields,
docvalue_fields: computedFields.docvalueFields
}
Expand Down
1 change: 1 addition & 0 deletions src/core_plugins/kibana/public/management/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'ui/filters/start_from';
import 'ui/field_editor';
import 'plugins/kibana/management/sections/indices/_indexed_fields';
import 'plugins/kibana/management/sections/indices/_scripted_fields';
import 'plugins/kibana/management/sections/indices/source_filters/source_filters';
import 'ui/directives/bread_crumbs';
import uiRoutes from 'ui/routes';
import uiModules from 'ui/modules';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,30 @@

<br />

<!-- tab list -->
<ul class="nav nav-tabs">
<li class="kbn-management-tab" ng-class="{ active: state.tab === fieldType.index }" ng-repeat="fieldType in fieldTypes">
<a ng-click="changeTab(fieldType)">
{{ fieldType.title }}
<small>({{ fieldType.count }})</small>
<li class="kbn-management-tab" ng-class="{ active: state.tab === editSection.index }" ng-repeat="editSection in editSections">
<a ng-click="changeTab(editSection)">
{{ editSection.title }}
<small>({{ editSection.count }})</small>
</a>
</li>
</ul>

<indexed-fields ng-show="state.tab == 'indexedFields'" class="fields indexed-fields"></indexed-fields>
<scripted-fields ng-show="state.tab == 'scriptedFields'" class="fields scripted-fields"></scripted-fields>
<!-- tabs -->
<indexed-fields
ng-show="state.tab == 'indexedFields'"
class="fields indexed-fields"
></indexed-fields>
<scripted-fields
ng-show="state.tab == 'scriptedFields'"
class="fields scripted-fields"
></scripted-fields>
<source-filters
ng-show="state.tab == 'sourceFilters'"
index-pattern="indexPattern"
class="fields source-filters"
></source-filters>

</div>
</kbn-management-indices>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import _ from 'lodash';
import 'plugins/kibana/management/sections/indices/_indexed_fields';
import 'plugins/kibana/management/sections/indices/_scripted_fields';
import 'plugins/kibana/management/sections/indices/source_filters/source_filters';
import 'plugins/kibana/management/sections/indices/_index_header';
import RefreshKibanaIndex from 'plugins/kibana/management/sections/indices/_refresh_kibana_index';
import UrlProvider from 'ui/url';
import IndicesFieldTypesProvider from 'plugins/kibana/management/sections/indices/_field_types';
import IndicesEditSectionsProvider from 'plugins/kibana/management/sections/indices/_edit_sections';
import uiRoutes from 'ui/routes';
import uiModules from 'ui/modules';
import editTemplate from 'plugins/kibana/management/sections/indices/_edit.html';
Expand Down Expand Up @@ -51,9 +52,8 @@ uiModules.get('apps/management')
docTitle.change($scope.indexPattern.id);
const otherIds = _.without($route.current.locals.indexPatternIds, $scope.indexPattern.id);

const fieldTypes = Private(IndicesFieldTypesProvider);
$scope.$watch('indexPattern.fields', function () {
$scope.fieldTypes = fieldTypes($scope.indexPattern);
$scope.editSections = Private(IndicesEditSectionsProvider)($scope.indexPattern);
});

$scope.changeTab = function (obj) {
Expand All @@ -62,7 +62,7 @@ uiModules.get('apps/management')
};

$scope.$watch('state.tab', function (tab) {
if (!tab) $scope.changeTab($scope.fieldTypes[0]);
if (!tab) $scope.changeTab($scope.editSections[0]);
});

$scope.$watchCollection('indexPattern.fields', function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import _ from 'lodash';
export default function GetFieldTypes() {

return function (indexPattern) {
const fieldCount = _.countBy(indexPattern.fields, function (field) {
return (field.scripted) ? 'scripted' : 'indexed';
});

_.defaults(fieldCount, {
indexed: 0,
scripted: 0,
sourceFilters: 0
});

return [
{
title: 'fields',
index: 'indexedFields',
count: fieldCount.indexed
},
{
title: 'scripted fields',
index: 'scriptedFields',
count: fieldCount.scripted
},
{
title: 'source filters',
index: 'sourceFilters',
count: fieldCount.sourceFilters
}
];
};
};

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import nameHtml from 'plugins/kibana/management/sections/indices/_field_name.htm
import typeHtml from 'plugins/kibana/management/sections/indices/_field_type.html';
import controlsHtml from 'plugins/kibana/management/sections/indices/_field_controls.html';
import uiModules from 'ui/modules';
import FieldWildcardProvider from 'ui/field_wildcard';
import indexedFieldsTemplate from 'plugins/kibana/management/sections/indices/_indexed_fields.html';

uiModules.get('apps/management')
.directive('indexedFields', function ($filter) {
.directive('indexedFields', function (Private, $filter) {
const yesTemplate = '<i class="fa fa-check" aria-label="yes"></i>';
const noTemplate = '';
const filter = $filter('filter');
const { fieldWildcardMatcher } = Private(FieldWildcardProvider);

return {
restrict: 'E',
Expand All @@ -26,6 +28,7 @@ uiModules.get('apps/management')
{ title: 'searchable', info: 'These fields can be used in the filter bar' },
{ title: 'aggregatable' , info: 'These fields can be used in visualization aggregations' },
{ title: 'analyzed', info: 'Analyzed fields may require extra memory to visualize' },
{ title: 'excluded', info: 'Fields that are excluded from _source when it is fetched' },
{ title: 'controls', sortable: false }
];

Expand All @@ -34,14 +37,17 @@ uiModules.get('apps/management')
function refreshRows() {
// clear and destroy row scopes
_.invoke(rowScopes.splice(0), '$destroy');

const fields = filter($scope.indexPattern.getNonScriptedFields(), $scope.fieldFilter);
_.find($scope.fieldTypes, {index: 'indexedFields'}).count = fields.length; // Update the tab count
const sourceFilters = $scope.indexPattern.sourceFilters && $scope.indexPattern.sourceFilters.map(f => f.value) || [];
const fieldWildcardMatch = fieldWildcardMatcher(sourceFilters);
_.find($scope.editSections, {index: 'indexedFields'}).count = fields.length; // Update the tab count

$scope.rows = fields.map(function (field) {
const childScope = _.assign($scope.$new(), { field: field });
rowScopes.push(childScope);

const excluded = fieldWildcardMatch(field.name);

return [
{
markup: nameHtml,
Expand All @@ -66,6 +72,10 @@ uiModules.get('apps/management')
markup: field.analyzed ? yesTemplate : noTemplate,
value: field.analyzed
},
{
markup: excluded ? yesTemplate : noTemplate,
value: excluded
},
{
markup: controlsHtml,
scope: childScope
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ uiModules.get('apps/management')
rowScopes.length = 0;

const fields = filter($scope.indexPattern.getScriptedFields(), $scope.fieldFilter);
_.find($scope.fieldTypes, {index: 'scriptedFields'}).count = fields.length; // Update the tab count
_.find($scope.editSections, {index: 'scriptedFields'}).count = fields.length; // Update the tab count

$scope.rows = fields.map(function (field) {
const rowScope = $scope.$new();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<div class="actions">
<button
aria-label="Edit source filter"
ng-if="sourceFilters.editing !== filter"
ng-click="sourceFilters.editing = filter"
type="button"
class="btn btn-xs btn-default">
<i aria-hidden="true" class="fa fa-pencil"></i>
</button>
<button
aria-label="Save source filter"
ng-if="sourceFilters.editing === filter"
ng-click="sourceFilters.save()"
ng-disabled="!filter.value"
type="button"
class="btn btn-xs btn-primary">
<i aria-hidden="true" class="fa fa-save"></i>
</button>
<button
aria-label="Delete source filter"
ng-click="sourceFilters.delete(filter)"
type="button"
class="btn btn-xs btn-danger">
<i aria-hidden="true" class="fa fa-trash"></i>
</button>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<div class="value">
<span ng-if="sourceFilters.editing !== filter">{{ filter.value }}</span>

<input
ng-model="filter.value"
input-focus
ng-if="sourceFilters.editing === filter"
placeholder="{{ sourceFilters.placeHolder }}"
type="text"
required
class="form-control">
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<h3>Source Filters</h3>

<p>
Source filters can be used to exclude one or more fields when fetching the document source. This happens when viewing a document in the Discover app, or with a table displaying results from a saved search in the Dashboard app. Each row is built using the source of a single document, and if you have documents with large or unimportant fields you may benefit from filtering those out at this lower level.
</p>

<p>
Note that multi-fields will incorrectly appear as matches in the table below. These filters only actually apply to fields in the original source document, so matching multi-fields are not actually being filtered.
</p>

<div ng-class="{ saving: sourceFilters.saving }" class="source-filters-container">

<form name="form" ng-submit="sourceFilters.create()">
<div class="input-group">
<input
ng-model="sourceFilters.newValue"
placeholder="{{ sourceFilters.placeHolder }}"
type="text"
class="form-control">

<div class="input-group-btn" role="group" aria-label="Source Filter Editor Controls">
<button
type="submit"
class="btn btn-primary"
ng-disabled="!sourceFilters.newValue">
Add
</button>
</div>
</div>
</form>

<paginated-table
columns="columns"
rows="rows"
per-page="perPage">
</paginated-table>
</div>
Loading