[ingest/register_fields_capabilities] prevent calling reply() twice

This commit is contained in:
spalger 2016-09-30 14:29:46 +02:00
parent a23cd39bd9
commit e06e659035

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));
}
);
}
});
}