diff --git a/x-pack/legacy/plugins/epm/server/datasources/create.ts b/x-pack/legacy/plugins/epm/server/datasources/create.ts index 54f3869b1efb1..f1bbe55f9986b 100644 --- a/x-pack/legacy/plugins/epm/server/datasources/create.ts +++ b/x-pack/legacy/plugins/epm/server/datasources/create.ts @@ -44,11 +44,14 @@ export async function createDatasource(options: { const streams: Stream[] = []; if (pkg.datasets) { for (const dataset of pkg.datasets) { - streams.push({ - id: dataset.name, - input: yaml.load(await getConfig(pkgkey, dataset)), - output_id: 'default', - }); + const input = yaml.load(await getConfig(pkgkey, dataset)); + if (input) { + streams.push({ + id: dataset.name, + input, + output_id: 'default', + }); + } } } @@ -178,7 +181,7 @@ async function ingestDatasourceCreate({ const url = `${origin}${basePath}${apiPath}`; const body = { datasource }; delete request.headers['transfer-encoding']; - return fetch(url, { + await fetch(url, { method: 'post', body: JSON.stringify(body), headers: { @@ -187,7 +190,7 @@ async function ingestDatasourceCreate({ // the main (only?) one we want is `authorization` ...request.headers, }, - }).then(response => response.json()); + }); } async function getConfig(pkgkey: string, dataset: Dataset): Promise { diff --git a/x-pack/legacy/plugins/fleet/server/libs/policy.ts b/x-pack/legacy/plugins/fleet/server/libs/policy.ts index 63d21e83e03c2..e2b2944137571 100644 --- a/x-pack/legacy/plugins/fleet/server/libs/policy.ts +++ b/x-pack/legacy/plugins/fleet/server/libs/policy.ts @@ -16,7 +16,7 @@ export class PolicyLib { return flatten( datasources.map((ds: Datasource) => { return ds.streams.map(stream => ({ - ...stream.config, + ...stream.input, id: stream.id, type: stream.input.type as any, output: { use_output: stream.output_id }, diff --git a/x-pack/legacy/plugins/ingest/server/libs/types.ts b/x-pack/legacy/plugins/ingest/server/libs/types.ts index ab04b5fa447ad..c706804a51d37 100644 --- a/x-pack/legacy/plugins/ingest/server/libs/types.ts +++ b/x-pack/legacy/plugins/ingest/server/libs/types.ts @@ -50,8 +50,6 @@ export interface Datasource extends SavedObjectAttributes { package: Package; read_alias?: string; streams: Stream[]; - // TODO: These are the input parts of the streams. To be remove again when we have the streams - inputs: string[]; } /** diff --git a/x-pack/legacy/plugins/ingest/server/mappings.ts b/x-pack/legacy/plugins/ingest/server/mappings.ts index 7596d4b36995b..c00a86b1fae44 100644 --- a/x-pack/legacy/plugins/ingest/server/mappings.ts +++ b/x-pack/legacy/plugins/ingest/server/mappings.ts @@ -79,29 +79,7 @@ export const mappings = { type: 'keyword', }, input: { - properties: { - config: { - type: 'flattened', - }, - fields: { - type: 'flattened', - }, - id: { - type: 'keyword', - }, - ilm_policy: { - type: 'keyword', - }, - index_template: { - type: 'keyword', - }, - ingest_pipelines: { - type: 'keyword', - }, - type: { - type: 'keyword', - }, - }, + type: 'flattened', }, output_id: { type: 'keyword',