Using correct index patterns (#69208)

This commit is contained in:
Jonathan Buttner 2020-06-15 17:42:18 -04:00 committed by GitHub
parent ecd3c9b517
commit 4f5e279d75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,6 +7,7 @@
import { TypeOf } from '@kbn/config-schema';
import { RequestHandler, Logger } from 'kibana/server';
import { validateAlerts } from '../../../../common/endpoint/schema/resolver';
import { eventsIndexPattern } from '../../../../common/endpoint/constants';
import { Fetcher } from './utils/fetch';
import { EndpointAppContext } from '../../types';
@ -20,11 +21,9 @@ export function handleAlerts(
query: { alerts, afterAlert, legacyEndpointID: endpointID },
} = req;
try {
const indexRetriever = endpointAppContext.service.getIndexPatternRetriever();
const client = context.core.elasticsearch.legacy.client;
const indexPattern = await indexRetriever.getEventIndexPattern(context);
const fetcher = new Fetcher(client, id, indexPattern, endpointID);
const fetcher = new Fetcher(client, id, eventsIndexPattern, endpointID);
return res.ok({
body: await fetcher.alerts(alerts, afterAlert),