File tree Expand file tree Collapse file tree 4 files changed +18
-4
lines changed
models/data_frame_analytics Expand file tree Collapse file tree 4 files changed +18
-4
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+ * or more contributor license agreements. Licensed under the Elastic License
4+ * 2.0; you may not use this file except in compliance with the Elastic License
5+ * 2.0.
6+ */
7+
8+ /**
9+ * Default page for the trained_models endpoint is 100,
10+ * which is too small for the most cases, so we set it to 10000.
11+ */
12+ export const DEFAULT_TRAINED_MODELS_PAGE_SIZE = 10000 ;
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import {
2020} from '@kbn/ml-data-frame-analytics-utils' ;
2121import { isPopulatedObject } from '@kbn/ml-is-populated-object' ;
2222import type { CloudSetup } from '@kbn/cloud-plugin/server' ;
23+ import { DEFAULT_TRAINED_MODELS_PAGE_SIZE } from '../../../common/constants/trained_models' ;
2324import type { MlFeatures } from '../../../common/constants/app' ;
2425import type { ModelService } from '../model_management/models_provider' ;
2526import { modelsProvider } from '../model_management' ;
@@ -38,7 +39,6 @@ import {
3839 isTransformLinkReturnType ,
3940} from './types' ;
4041import type { MlClient } from '../../lib/ml_client' ;
41- import { DEFAULT_TRAINED_MODELS_PAGE_SIZE } from '../../routes/trained_models' ;
4242
4343export class AnalyticsManager {
4444 private _trainedModels : estypes . MlTrainedModelConfig [ ] = [ ] ;
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import type {
1717} from '@kbn/ml-trained-models-utils' ;
1818import { isDefined } from '@kbn/ml-is-defined' ;
1919import type { IScopedClusterClient } from '@kbn/core-elasticsearch-server' ;
20+ import { DEFAULT_TRAINED_MODELS_PAGE_SIZE } from '../../common/constants/trained_models' ;
2021import { type MlFeatures , ML_INTERNAL_BASE_PATH } from '../../common/constants/app' ;
2122import type { RouteInitialization } from '../types' ;
2223import { wrapError } from '../client/error_wrapper' ;
@@ -44,8 +45,6 @@ import { mlLog } from '../lib/log';
4445import { forceQuerySchema } from './schemas/anomaly_detectors_schema' ;
4546import { modelsProvider } from '../models/model_management' ;
4647
47- export const DEFAULT_TRAINED_MODELS_PAGE_SIZE = 10000 ;
48-
4948export function filterForEnabledFeatureModels <
5049 T extends TrainedModelConfigResponse | estypes . MlTrainedModelConfig
5150> ( models : T [ ] , enabledFeatures : MlFeatures ) {
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import {
1212 type IScopedClusterClient ,
1313 SavedObjectsClient ,
1414} from '@kbn/core/server' ;
15+ import { DEFAULT_TRAINED_MODELS_PAGE_SIZE } from '../../common/constants/trained_models' ;
1516import type { TrainedModelJob , MLSavedObjectService } from './service' ;
1617import { ML_JOB_SAVED_OBJECT_TYPE } from '../../common/types/saved_objects' ;
1718
@@ -86,7 +87,9 @@ export function mlFunctionsFactory(client: IScopedClusterClient) {
8687 } ,
8788 async getTrainedModels ( ) {
8889 try {
89- return await client . asInternalUser . ml . getTrainedModels ( ) ;
90+ return await client . asInternalUser . ml . getTrainedModels ( {
91+ size : DEFAULT_TRAINED_MODELS_PAGE_SIZE ,
92+ } ) ;
9093 } catch ( error ) {
9194 return null ;
9295 }
You can’t perform that action at this time.
0 commit comments