diff --git a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/alerts/use_fetch_ecs_alerts_data.ts b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/alerts/use_fetch_ecs_alerts_data.ts index 8af47812849248..b082d90fc14889 100644 --- a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/alerts/use_fetch_ecs_alerts_data.ts +++ b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/alerts/use_fetch_ecs_alerts_data.ts @@ -5,7 +5,7 @@ * 2.0. */ import { useEffect, useState } from 'react'; -import { SearchResponse } from 'elasticsearch'; +import type { estypes } from '@elastic/elasticsearch'; import { isEmpty } from 'lodash'; import { @@ -37,7 +37,7 @@ export const useFetchEcsAlertsData = ({ try { setIsLoading(true); const alertResponse = await KibanaServices.get().http.fetch< - SearchResponse<{ '@timestamp': string; [key: string]: unknown }> + estypes.SearchResponse<{ '@timestamp': string; [key: string]: unknown }> >(DETECTION_ENGINE_QUERY_SIGNALS_URL, { method: 'POST', body: JSON.stringify(buildAlertsQuery(alertIds ?? [])), @@ -45,10 +45,10 @@ export const useFetchEcsAlertsData = ({ setAlertEcsData( alertResponse?.hits.hits.reduce( - (acc, { _id, _index, _source }) => [ + (acc, { _id, _index, _source = {} }) => [ ...acc, { - ...formatAlertToEcsSignal(_source as {}), + ...formatAlertToEcsSignal(_source), _id, _index, timestamp: _source['@timestamp'], diff --git a/x-pack/plugins/timelines/public/container/use_update_alerts.ts b/x-pack/plugins/timelines/public/container/use_update_alerts.ts index 7576c831554cd3..8e18281e788241 100644 --- a/x-pack/plugins/timelines/public/container/use_update_alerts.ts +++ b/x-pack/plugins/timelines/public/container/use_update_alerts.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { UpdateDocumentByQueryResponse } from 'elasticsearch'; +import type { estypes } from '@elastic/elasticsearch'; + import { useKibana } from '../../../../../src/plugins/kibana_react/public'; import { AlertStatus } from '../../../timelines/common'; @@ -24,7 +25,7 @@ export const useUpdateAlertsStatus = (): { updateAlertStatus: (params: { query: object; status: AlertStatus; - }) => Promise; + }) => Promise; } => { const { http } = useKibana().services;