Merge pull request #8674 from elastic/jasper/backport/8505/5.0

[backport] PR #8505 to 5.0 - [ingest/register_fields_capabilities] prevent calling reply() twice
This commit is contained in:
Spencer 2016-10-13 16:43:20 -07:00 committed by GitHub
commit 44d2a4c153

View file

@ -15,17 +15,19 @@ export function registerFieldCapabilities(server) {
index: indices,
allowNoIndices: false
})
.catch((error) => {
reply(handleESError(error));
})
.then((res) => {
const fields = _.get(res, 'indices._all.fields', {});
const fieldsFilteredValues = _.mapValues(fields, (value) => {
return _.pick(value, ['searchable', 'aggregatable']);
});
.then(
(res) => {
const fields = _.get(res, 'indices._all.fields', {});
const fieldsFilteredValues = _.mapValues(fields, (value) => {
return _.pick(value, ['searchable', 'aggregatable']);
});
reply({fields: fieldsFilteredValues});
});
reply({fields: fieldsFilteredValues});
},
(error) => {
reply(handleESError(error));
}
);
}
});
}