Skip to content

Commit

Permalink
[ML] Fixing records and buckets results endpoints (#59313)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgowdyelastic authored Mar 4, 2020
1 parent c58b49c commit a6d2b57
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions x-pack/plugins/ml/server/routes/anomaly_detectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand All @@ -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,
Expand Down Expand Up @@ -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()),
}),
Expand All @@ -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,
Expand Down

0 comments on commit a6d2b57

Please sign in to comment.