diff --git a/x-pack/plugins/monitoring/server/kibana_monitoring/collectors/get_settings_collector.js b/x-pack/plugins/monitoring/server/kibana_monitoring/collectors/get_settings_collector.js index 1382abb4ea293..401ee9f4766cb 100644 --- a/x-pack/plugins/monitoring/server/kibana_monitoring/collectors/get_settings_collector.js +++ b/x-pack/plugins/monitoring/server/kibana_monitoring/collectors/get_settings_collector.js @@ -61,7 +61,7 @@ export function getSettingsCollector(server, kbnServer) { return collectorSet.makeStatsCollector({ type: KIBANA_SETTINGS_TYPE, async fetch(callCluster) { - let kibanaSettingsData; + let kibanaSettingsData = null; const defaultAdminEmail = await checkForEmailValue(config, callCluster); // skip everything if defaultAdminEmail === undefined @@ -79,10 +79,16 @@ export function getSettingsCollector(server, kbnServer) { // remember the current email so that we can mark it as successful if the bulk does not error out shouldUseNull = !!defaultAdminEmail; - return { - kibana: getKibanaInfoForStats(server, kbnServer), - ...kibanaSettingsData - }; + // return nothing when there was no result + let settingsDoc; + if (kibanaSettingsData !== null) { + settingsDoc = { + kibana: getKibanaInfoForStats(server, kbnServer), + ...kibanaSettingsData + }; + } + + return settingsDoc; } }); }