From 6db108b914a1e9369bb720e3fd198bfb3fcd6ddb Mon Sep 17 00:00:00 2001 From: James Gowdy Date: Tue, 20 Oct 2020 14:00:29 +0100 Subject: [PATCH] [ML] Fixing exclude frequent in advanced wizard (#81121) * [ML] Fixing exclude frequent in advanced wizard * updating description * adding exclude_frequent to test --- .../advanced_detector_modal/advanced_detector_modal.tsx | 7 ++++++- .../components/advanced_detector_modal/descriptions.tsx | 2 +- .../ml/server/routes/schemas/anomaly_detectors_schema.ts | 2 ++ .../api_integration/apis/ml/job_validation/validate.ts | 8 +++++++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/advanced_detector_modal.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/advanced_detector_modal.tsx index 7d71583977204..7d2c7d60e3ee6 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/advanced_detector_modal.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/advanced_detector_modal.tsx @@ -58,7 +58,12 @@ const emptyOption: EuiComboBoxOptionOption = { label: '', }; -const excludeFrequentOptions: EuiComboBoxOptionOption[] = [{ label: 'all' }, { label: 'none' }]; +const excludeFrequentOptions: EuiComboBoxOptionOption[] = [ + { label: 'all' }, + { label: 'none' }, + { label: 'by' }, + { label: 'over' }, +]; export const AdvancedDetectorModal: FC = ({ payload, diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/descriptions.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/descriptions.tsx index 54fd8ba035958..280ac85a5a2bc 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/descriptions.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/descriptions.tsx @@ -142,7 +142,7 @@ export const ExcludeFrequentDescription: FC = memo(({ children }) => { description={ } > diff --git a/x-pack/plugins/ml/server/routes/schemas/anomaly_detectors_schema.ts b/x-pack/plugins/ml/server/routes/schemas/anomaly_detectors_schema.ts index 9203c7cf997a6..005099e96581c 100644 --- a/x-pack/plugins/ml/server/routes/schemas/anomaly_detectors_schema.ts +++ b/x-pack/plugins/ml/server/routes/schemas/anomaly_detectors_schema.ts @@ -26,6 +26,8 @@ const detectorSchema = schema.object({ over_field_name: schema.maybe(schema.string()), partition_field_name: schema.maybe(schema.string()), detector_description: schema.maybe(schema.string()), + exclude_frequent: schema.maybe(schema.string()), + use_null: schema.maybe(schema.boolean()), /** Custom rules */ custom_rules: customRulesSchema, }); diff --git a/x-pack/test/api_integration/apis/ml/job_validation/validate.ts b/x-pack/test/api_integration/apis/ml/job_validation/validate.ts index 8f78cdf015601..e4e6adca9640f 100644 --- a/x-pack/test/api_integration/apis/ml/job_validation/validate.ts +++ b/x-pack/test/api_integration/apis/ml/job_validation/validate.ts @@ -35,7 +35,13 @@ export default ({ getService }: FtrProviderContext) => { groups: [], analysis_config: { bucket_span: '15m', - detectors: [{ function: 'mean', field_name: 'products.discount_amount' }], + detectors: [ + { + function: 'mean', + field_name: 'products.discount_amount', + exclude_frequent: 'none', + }, + ], influencers: [], summary_count_field_name: 'doc_count', },