diff --git a/x-pack/legacy/plugins/ml/server/new_platform/job_validation_schema.ts b/x-pack/legacy/plugins/ml/server/new_platform/job_validation_schema.ts index 1cc6e8a97ffc05..5917ec50884d80 100644 --- a/x-pack/legacy/plugins/ml/server/new_platform/job_validation_schema.ts +++ b/x-pack/legacy/plugins/ml/server/new_platform/job_validation_schema.ts @@ -11,6 +11,7 @@ export const estimateBucketSpanSchema = schema.object({ aggTypes: schema.arrayOf(schema.nullable(schema.string())), duration: schema.object({ start: schema.number(), end: schema.number() }), fields: schema.arrayOf(schema.nullable(schema.string())), + filters: schema.maybe(schema.arrayOf(schema.any())), index: schema.string(), query: schema.any(), splitField: schema.maybe(schema.string()), diff --git a/x-pack/test/api_integration/apis/ml/bucket_span_estimator.ts b/x-pack/test/api_integration/apis/ml/bucket_span_estimator.ts index 47afe7553fe62b..1c7245234b089f 100644 --- a/x-pack/test/api_integration/apis/ml/bucket_span_estimator.ts +++ b/x-pack/test/api_integration/apis/ml/bucket_span_estimator.ts @@ -69,6 +69,23 @@ export default ({ getService }: FtrProviderContext) => { responseBody: { name: '3h', ms: 10800000 }, }, }, + { + testTitleSuffix: 'with 1 field, 1 agg, no split, and empty filters', + user: USER.ML_POWERUSER, + requestBody: { + aggTypes: ['avg'], + duration: { start: 1560297859000, end: 1562975136000 }, + fields: ['taxless_total_price'], + filters: [], + index: 'ecommerce', + query: { bool: { must: [{ match_all: {} }] } }, + timeField: 'order_date', + }, + expected: { + responseCode: 200, + responseBody: { name: '15m', ms: 900000 }, + }, + }, ]; describe('bucket span estimator', function() {