From d6aa0c37c7d671883aacaa50fb1095d563ef2250 Mon Sep 17 00:00:00 2001 From: James Gowdy Date: Fri, 15 Jan 2021 09:47:39 +0000 Subject: [PATCH] [ML] Fixing cloning of anomaly detection job with sparse data (#88322) * [ML] Fixing cloming of anomaly detection job with sparse data * removing from population wizard --- .../application/jobs/new_job/common/job_creator/job_creator.ts | 3 +-- .../new_job/common/job_creator/multi_metric_job_creator.ts | 2 ++ .../new_job/common/job_creator/single_metric_job_creator.ts | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/job_creator.ts b/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/job_creator.ts index c3b4471269bb8..c66527f1fb213 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/job_creator.ts +++ b/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/job_creator.ts @@ -28,7 +28,7 @@ import { CREATED_BY_LABEL, SHARED_RESULTS_INDEX_NAME, } from '../../../../../../common/constants/new_job'; -import { isSparseDataJob, collectAggs } from './util/general'; +import { collectAggs } from './util/general'; import { parseInterval } from '../../../../../../common/util/parse_interval'; import { Calendar } from '../../../../../../common/types/calendars'; import { mlCalendarService } from '../../../../services/calendar_service'; @@ -681,7 +681,6 @@ export class JobCreator { ) { this.useDedicatedIndex = true; } - this._sparseData = isSparseDataJob(job, datafeed); this._scriptFields = []; if (this._datafeed_config.script_fields !== undefined) { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/multi_metric_job_creator.ts b/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/multi_metric_job_creator.ts index 95141f31cdea6..a476d72851dbb 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/multi_metric_job_creator.ts +++ b/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/multi_metric_job_creator.ts @@ -17,6 +17,7 @@ import { createBasicDetector } from './util/default_configs'; import { JOB_TYPE, CREATED_BY_LABEL } from '../../../../../../common/constants/new_job'; import { getRichDetectors } from './util/general'; import { IndexPattern } from '../../../../../../../../../src/plugins/data/public'; +import { isSparseDataJob } from './util/general'; export class MultiMetricJobCreator extends JobCreator { // a multi-metric job has one optional overall partition field @@ -92,6 +93,7 @@ export class MultiMetricJobCreator extends JobCreator { public cloneFromExistingJob(job: Job, datafeed: Datafeed) { this._overrideConfigs(job, datafeed); this.createdBy = CREATED_BY_LABEL.MULTI_METRIC; + this._sparseData = isSparseDataJob(job, datafeed); const detectors = getRichDetectors(job, datafeed, this.additionalFields, false); if (datafeed.aggregations !== undefined) { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/single_metric_job_creator.ts b/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/single_metric_job_creator.ts index e884da5470cc5..58d192732b13d 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/single_metric_job_creator.ts +++ b/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/single_metric_job_creator.ts @@ -22,6 +22,7 @@ import { import { JOB_TYPE, CREATED_BY_LABEL } from '../../../../../../common/constants/new_job'; import { getRichDetectors } from './util/general'; import { IndexPattern } from '../../../../../../../../../src/plugins/data/public'; +import { isSparseDataJob } from './util/general'; export class SingleMetricJobCreator extends JobCreator { protected _type: JOB_TYPE = JOB_TYPE.SINGLE_METRIC; @@ -196,6 +197,7 @@ export class SingleMetricJobCreator extends JobCreator { public cloneFromExistingJob(job: Job, datafeed: Datafeed) { this._overrideConfigs(job, datafeed); this.createdBy = CREATED_BY_LABEL.SINGLE_METRIC; + this._sparseData = isSparseDataJob(job, datafeed); const detectors = getRichDetectors(job, datafeed, this.additionalFields, false); this.removeAllDetectors();