From 813f42afa988826a7f0e138b7a3bd47ad223bfe3 Mon Sep 17 00:00:00 2001 From: Melissa Alvarez Date: Tue, 31 Mar 2020 11:26:35 -0400 Subject: [PATCH] [ML] Settings: Increase number of items that can be paged in calendars and filters lists (#61842) (#61970) * set size limit to 1000 for calendars/filters get routes * update comment * update default size comment --- x-pack/plugins/ml/server/client/elasticsearch_ml.ts | 8 ++++---- x-pack/plugins/ml/server/routes/calendars.ts | 1 + x-pack/plugins/ml/server/routes/filters.ts | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/ml/server/client/elasticsearch_ml.ts b/x-pack/plugins/ml/server/client/elasticsearch_ml.ts index ed4dc64cde3bd..caedaed92e5b1 100644 --- a/x-pack/plugins/ml/server/client/elasticsearch_ml.ts +++ b/x-pack/plugins/ml/server/client/elasticsearch_ml.ts @@ -514,7 +514,7 @@ export const elasticsearchJsPlugin = (Client: any, config: any, components: any) needBody: true, method: 'POST', }); - + // Currently the endpoint uses a default size of 100 unless a size is supplied. So until paging is supported in the UI, explicitly supply a size of 1000 ml.calendars = ca({ urls: [ { @@ -526,7 +526,7 @@ export const elasticsearchJsPlugin = (Client: any, config: any, components: any) }, }, { - fmt: '/_ml/calendars/', + fmt: '/_ml/calendars?size=1000', }, ], method: 'GET', @@ -671,7 +671,7 @@ export const elasticsearchJsPlugin = (Client: any, config: any, components: any) }, method: 'DELETE', }); - + // Currently the endpoint uses a default size of 100 unless a size is supplied. So until paging is supported in the UI, explicitly supply a size of 1000 ml.filters = ca({ urls: [ { @@ -683,7 +683,7 @@ export const elasticsearchJsPlugin = (Client: any, config: any, components: any) }, }, { - fmt: '/_ml/filters/', + fmt: '/_ml/filters?size=1000', }, ], method: 'GET', diff --git a/x-pack/plugins/ml/server/routes/calendars.ts b/x-pack/plugins/ml/server/routes/calendars.ts index 63984728a18dd..34950c6ed79f7 100644 --- a/x-pack/plugins/ml/server/routes/calendars.ts +++ b/x-pack/plugins/ml/server/routes/calendars.ts @@ -42,6 +42,7 @@ function getCalendarsByIds(context: RequestHandlerContext, calendarIds: string) } export function calendars({ router, mlLicense }: RouteInitialization) { + // Gets calendars - size limit has been explicitly set to 1000 router.get( { path: '/api/ml/calendars', diff --git a/x-pack/plugins/ml/server/routes/filters.ts b/x-pack/plugins/ml/server/routes/filters.ts index 2f823d79a8e53..e827ed96b12af 100644 --- a/x-pack/plugins/ml/server/routes/filters.ts +++ b/x-pack/plugins/ml/server/routes/filters.ts @@ -47,7 +47,7 @@ export function filtersRoutes({ router, mlLicense }: RouteInitialization) { /** * @apiGroup Filters * - * @api {get} /api/ml/filters Gets filters + * @api {get} /api/ml/filters Gets filters - size limit has been explicitly set to 1000 * @apiName GetFilters * @apiDescription Retrieves the list of filters which are used for custom rules in anomaly detection. *