Skip to content

Commit

Permalink
Using correct index patterns (#69208)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-buttner authored Jun 15, 2020
1 parent ecd3c9b commit 4f5e279
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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),
Expand Down

0 comments on commit 4f5e279

Please sign in to comment.