mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[ML] Fix retention of categorization example limits (#182103)
When updating a job's model memory limits via the UI, if `categorization_examples_limit` has been set in `analysis_limits`, the configured value is replaced by the default value of `4`. This appears to be a [bug](https://github.com/elastic/elasticsearch/issues/108068) in elasticsearch and so this PR is a workaround to ensure the original `categorization_examples_limit` is sent as part of the update to ensure it isn't reset to the default. Also fixes an issue in the advanced job wizard where setting `categorization_examples_limit` in the JSON is not retained when saving the JSON.
This commit is contained in:
parent
06f3c30c9d
commit
0842c60845
2 changed files with 20 additions and 4 deletions
|
@ -104,6 +104,14 @@ function extractMML(job, newJobData) {
|
|||
if (mml !== job.analysis_limits.model_memory_limit) {
|
||||
mmlData.analysis_limits = {
|
||||
model_memory_limit: mml,
|
||||
// work around for issue in es where categorization_examples_limit will be reset to the default value
|
||||
// if it is not included in the update request
|
||||
// https://github.com/elastic/elasticsearch/issues/108068
|
||||
...(job.analysis_limits.categorization_examples_limit !== undefined
|
||||
? {
|
||||
categorization_examples_limit: job.analysis_limits.categorization_examples_limit,
|
||||
}
|
||||
: {}),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import {
|
|||
} from '@kbn/ml-anomaly-utils';
|
||||
import type { RuntimeMappings } from '@kbn/ml-runtime-field-utils';
|
||||
import type { SavedSearch } from '@kbn/saved-search-plugin/public';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import type { IndexPatternTitle } from '../../../../../../common/types/kibana';
|
||||
import { getQueryFromSavedSearchObject } from '../../../../util/index_utils';
|
||||
import type {
|
||||
|
@ -327,11 +328,18 @@ export class JobCreator {
|
|||
|
||||
public set modelMemoryLimit(mml: string | null) {
|
||||
if (mml !== null) {
|
||||
this._job_config.analysis_limits = {
|
||||
model_memory_limit: mml,
|
||||
};
|
||||
if (this._job_config.analysis_limits === undefined) {
|
||||
this._job_config.analysis_limits = {};
|
||||
}
|
||||
this._job_config.analysis_limits.model_memory_limit = mml;
|
||||
} else {
|
||||
delete this._job_config.analysis_limits;
|
||||
if (this._job_config.analysis_limits !== undefined) {
|
||||
delete this._job_config.analysis_limits.model_memory_limit;
|
||||
|
||||
if (isPopulatedObject(this._job_config.analysis_limits) === false) {
|
||||
delete this._job_config.analysis_limits;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue