From a6d2b57777e139e7c79d1b7a4b57447ee43bcbdd Mon Sep 17 00:00:00 2001 From: James Gowdy Date: Wed, 4 Mar 2020 17:04:47 +0000 Subject: [PATCH] [ML] Fixing records and buckets results endpoints (#59313) --- .../ml/server/routes/anomaly_detectors.ts | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/ml/server/routes/anomaly_detectors.ts b/x-pack/plugins/ml/server/routes/anomaly_detectors.ts index 5e1ca72a7200..c6bb62aa3491 100644 --- a/x-pack/plugins/ml/server/routes/anomaly_detectors.ts +++ b/x-pack/plugins/ml/server/routes/anomaly_detectors.ts @@ -398,8 +398,12 @@ export function jobRoutes({ router, mlLicense }: RouteInitialization) { desc: schema.maybe(schema.boolean()), end: schema.maybe(schema.string()), exclude_interim: schema.maybe(schema.boolean()), - 'page.from': schema.maybe(schema.number()), - 'page.size': schema.maybe(schema.number()), + page: schema.maybe( + schema.object({ + from: schema.maybe(schema.number()), + size: schema.maybe(schema.number()), + }) + ), record_score: schema.maybe(schema.number()), sort: schema.maybe(schema.string()), start: schema.maybe(schema.string()), @@ -410,7 +414,7 @@ export function jobRoutes({ router, mlLicense }: RouteInitialization) { try { const results = await context.ml!.mlClient.callAsCurrentUser('ml.records', { jobId: request.params.jobId, - ...request.body, + body: request.body, }); return response.ok({ body: results, @@ -448,8 +452,12 @@ export function jobRoutes({ router, mlLicense }: RouteInitialization) { end: schema.maybe(schema.string()), exclude_interim: schema.maybe(schema.boolean()), expand: schema.maybe(schema.boolean()), - 'page.from': schema.maybe(schema.number()), - 'page.size': schema.maybe(schema.number()), + page: schema.maybe( + schema.object({ + from: schema.maybe(schema.number()), + size: schema.maybe(schema.number()), + }) + ), sort: schema.maybe(schema.string()), start: schema.maybe(schema.string()), }), @@ -460,7 +468,7 @@ export function jobRoutes({ router, mlLicense }: RouteInitialization) { const results = await context.ml!.mlClient.callAsCurrentUser('ml.buckets', { jobId: request.params.jobId, timestamp: request.params.timestamp, - ...request.body, + body: request.body, }); return response.ok({ body: results,