Skip to content

Commit

Permalink
Report shard failures in the field_capabilities response
Browse files Browse the repository at this point in the history
  • Loading branch information
Bargs committed Apr 28, 2017
1 parent 5ba57f7 commit 950a4e7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ export function registerFieldCapabilities(server) {
return _.pick(value, ['searchable', 'aggregatable']);
});

reply({ fields: fieldsFilteredValues });
const retVal = { fields: fieldsFilteredValues };
if (res._shards && res._shards.failed) {
retVal.shard_failure_response = res;
}

reply(retVal);
},
(error) => {
reply(handleESError(error));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
import chrome from 'ui/chrome';
import _ from 'lodash';
import { Notifier } from 'ui/notify/notifier';
import { ShardFailure } from 'ui/errors';

export function EnhanceFieldsWithCapabilitiesProvider($http) {
const notifier = new Notifier({
location: 'Field Capabilities'
});

return function (fields, indices) {
return $http.get(chrome.addBasePath(`/api/kibana/${indices}/field_capabilities`))
.then((res) => {
if (_.get(res, 'data.shard_failure_response')) {
notifier.warning(new ShardFailure(res.data.shard_failure_response));
}

const stats = _.get(res, 'data.fields', {});

return _.map(fields, (field) => {
Expand Down

0 comments on commit 950a4e7

Please sign in to comment.