update fetchLicense paths

This commit is contained in:
neptunian 2022-02-11 17:31:05 -05:00 committed by Jason Rhodes
parent 6a0b7b4f7b
commit 63759503b4

View file

@ -79,12 +79,13 @@ export async function fetchLicenses(
const response = await esClient.search<ElasticsearchSource>(params);
return (
response?.hits?.hits.map((hit) => {
const rawLicense = hit._source!.license ?? {};
const rawLicense =
hit._source!.license ?? hit._source?.elasticsearch?.cluster?.stats?.license ?? {};
const license: AlertLicense = {
status: rawLicense.status ?? '',
type: rawLicense.type ?? '',
expiryDateMS: rawLicense.expiry_date_in_millis ?? 0,
clusterUuid: hit._source!.cluster_uuid,
clusterUuid: hit._source?.elasticsearch?.cluster?.id || hit._source!.cluster_uuid,
ccs: hit._index,
};
return license;