diff --git a/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/multi_metric_job_creator.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/multi_metric_job_creator.ts index 947c1bcf6c1a42..8a4411bf9025f7 100644 --- a/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/multi_metric_job_creator.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/multi_metric_job_creator.ts @@ -92,12 +92,11 @@ export class MultiMetricJobCreator extends JobCreator { // not split field, use the default this.modelMemoryLimit = DEFAULT_MODEL_MEMORY_LIMIT; } else { - const fieldNames = this._detectors.map(d => d.field_name).filter(fn => fn !== undefined); const { modelMemoryLimit } = await ml.calculateModelMemoryLimit({ indexPattern: this._indexPatternTitle, splitFieldName: this._splitField.name, query: this._datafeed_config.query, - fieldNames, + fieldNames: this.fields.map(f => f.id), influencerNames: this._influencers, timeFieldName: this._job_config.data_description.time_field, earliestMs: this._start, diff --git a/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/influencers/influencers.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/influencers/influencers.tsx index c55bdeef4dde8f..5c5ba38b1c5a10 100644 --- a/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/influencers/influencers.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/influencers/influencers.tsx @@ -25,6 +25,9 @@ export const Influencers: FC = () => { useEffect(() => { jobCreator.removeAllInfluencers(); influencers.forEach(i => jobCreator.addInfluencer(i)); + if (jobCreator instanceof MultiMetricJobCreator) { + jobCreator.calculateModelMemoryLimit(); + } jobCreatorUpdate(); }, [influencers.join()]);