[ML] DF Analytics creation: update schema definition for create route (#56979) (#57353)

* fix df analytics create route schema definition

* add all optional params to schema definiton
This commit is contained in:
Melissa Alvarez 2020-02-11 16:24:29 -05:00 committed by GitHub
parent 2bbf64a79f
commit c0d064ef78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View file

@ -13,8 +13,16 @@ export const dataAnalyticsJobConfigSchema = {
results_field: schema.maybe(schema.string()),
}),
source: schema.object({
index: schema.string(),
index: schema.oneOf([schema.string(), schema.arrayOf(schema.string())]),
query: schema.maybe(schema.any()),
_source: schema.maybe(
schema.object({
includes: schema.maybe(schema.arrayOf(schema.maybe(schema.string()))),
excludes: schema.maybe(schema.arrayOf(schema.maybe(schema.string()))),
})
),
}),
allow_lazy_start: schema.maybe(schema.boolean()),
analysis: schema.any(),
analyzed_fields: schema.any(),
model_memory_limit: schema.string(),

View file

@ -108,7 +108,7 @@ export function dataFrameAnalyticsRoutes({ xpackMainPlugin, router }: RouteIniti
params: schema.object({
analyticsId: schema.string(),
}),
body: schema.object({ ...dataAnalyticsJobConfigSchema }),
body: schema.object(dataAnalyticsJobConfigSchema),
},
},
licensePreRoutingFactory(xpackMainPlugin, async (context, request, response) => {