import { Transport , TransportRequestOptions , TransportRequestOptionsWithMeta , TransportRequestOptionsWithOutMeta , TransportResult } from '@elastic/transport' ; import * as T from '../types' ; import * as TB from '../typesWithBodyKey' ; interface That { transport : Transport ; } export default class Ml { transport : Transport ; constructor ( transport ) { this . transport = transport ; } async closeJob ( this , params , options ? ) ; async closeJob ( this , params , options ? ) ; async closeJob ( this , params , options ? ) ; async closeJob ( this , params , options ? ) { const acceptedPath = [ 'job_id' ] ; const acceptedBody = [ 'allow_no_match' , 'force' , 'timeout' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = `/_ml/anomaly_detectors/${ encodeURIComponent ( params . job_id . toString ( ) ) }/_close` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async deleteCalendar ( this , params , options ? ) ; async deleteCalendar ( this , params , options ? ) ; async deleteCalendar ( this , params , options ? ) ; async deleteCalendar ( this , params , options ? ) { const acceptedPath = [ 'calendar_id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'DELETE' ; const path = `/_ml/calendars/${ encodeURIComponent ( params . calendar_id . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async deleteCalendarEvent ( this , params , options ? ) ; async deleteCalendarEvent ( this , params , options ? ) ; async deleteCalendarEvent ( this , params , options ? ) ; async deleteCalendarEvent ( this , params , options ? ) { const acceptedPath = [ 'calendar_id' , 'event_id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'DELETE' ; const path = `/_ml/calendars/${ encodeURIComponent ( params . calendar_id . toString ( ) ) }/events/${ encodeURIComponent ( params . event_id . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async deleteCalendarJob ( this , params , options ? ) ; async deleteCalendarJob ( this , params , options ? ) ; async deleteCalendarJob ( this , params , options ? ) ; async deleteCalendarJob ( this , params , options ? ) { const acceptedPath = [ 'calendar_id' , 'job_id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'DELETE' ; const path = `/_ml/calendars/${ encodeURIComponent ( params . calendar_id . toString ( ) ) }/jobs/${ encodeURIComponent ( params . job_id . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async deleteDataFrameAnalytics ( this , params , options ? ) ; async deleteDataFrameAnalytics ( this , params , options ? ) ; async deleteDataFrameAnalytics ( this , params , options ? ) ; async deleteDataFrameAnalytics ( this , params , options ? ) { const acceptedPath = [ 'id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'DELETE' ; const path = `/_ml/data_frame/analytics/${ encodeURIComponent ( params . id . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async deleteDatafeed ( this , params , options ? ) ; async deleteDatafeed ( this , params , options ? ) ; async deleteDatafeed ( this , params , options ? ) ; async deleteDatafeed ( this , params , options ? ) { const acceptedPath = [ 'datafeed_id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'DELETE' ; const path = `/_ml/datafeeds/${ encodeURIComponent ( params . datafeed_id . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async deleteExpiredData ( this , params ? , options ? ) ; async deleteExpiredData ( this , params ? , options ? ) ; async deleteExpiredData ( this , params ? , options ? ) ; async deleteExpiredData ( this , params ? , options ? ) { const acceptedPath = [ 'job_id' ] ; const acceptedBody = [ 'requests_per_second' , 'timeout' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } params = params ?? { } ; for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } let method = '' ; let path = '' ; if ( params . job_id != null ) { method = 'DELETE' ; path = `/_ml/_delete_expired_data/${ encodeURIComponent ( params . job_id . toString ( ) ) }` ; } else { method = 'DELETE' ; path = '/_ml/_delete_expired_data' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async deleteFilter ( this , params , options ? ) ; async deleteFilter ( this , params , options ? ) ; async deleteFilter ( this , params , options ? ) ; async deleteFilter ( this , params , options ? ) { const acceptedPath = [ 'filter_id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'DELETE' ; const path = `/_ml/filters/${ encodeURIComponent ( params . filter_id . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async deleteForecast ( this , params , options ? ) ; async deleteForecast ( this , params , options ? ) ; async deleteForecast ( this , params , options ? ) ; async deleteForecast ( this , params , options ? ) { const acceptedPath = [ 'job_id' , 'forecast_id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } let method = '' ; let path = '' ; if ( params . job_id != null && params . forecast_id != null ) { method = 'DELETE' ; path = `/_ml/anomaly_detectors/${ encodeURIComponent ( params . job_id . toString ( ) ) }/_forecast/${ encodeURIComponent ( params . forecast_id . toString ( ) ) }` ; } else { method = 'DELETE' ; path = `/_ml/anomaly_detectors/${ encodeURIComponent ( params . job_id . toString ( ) ) }/_forecast` ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async deleteJob ( this , params , options ? ) ; async deleteJob ( this , params , options ? ) ; async deleteJob ( this , params , options ? ) ; async deleteJob ( this , params , options ? ) { const acceptedPath = [ 'job_id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'DELETE' ; const path = `/_ml/anomaly_detectors/${ encodeURIComponent ( params . job_id . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async deleteModelSnapshot ( this , params , options ? ) ; async deleteModelSnapshot ( this , params , options ? ) ; async deleteModelSnapshot ( this , params , options ? ) ; async deleteModelSnapshot ( this , params , options ? ) { const acceptedPath = [ 'job_id' , 'snapshot_id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'DELETE' ; const path = `/_ml/anomaly_detectors/${ encodeURIComponent ( params . job_id . toString ( ) ) }/model_snapshots/${ encodeURIComponent ( params . snapshot_id . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async deleteTrainedModel ( this , params , options ? ) ; async deleteTrainedModel ( this , params , options ? ) ; async deleteTrainedModel ( this , params , options ? ) ; async deleteTrainedModel ( this , params , options ? ) { const acceptedPath = [ 'model_id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'DELETE' ; const path = `/_ml/trained_models/${ encodeURIComponent ( params . model_id . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async deleteTrainedModelAlias ( this , params , options ? ) ; async deleteTrainedModelAlias ( this , params , options ? ) ; async deleteTrainedModelAlias ( this , params , options ? ) ; async deleteTrainedModelAlias ( this , params , options ? ) { const acceptedPath = [ 'model_alias' , 'model_id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'DELETE' ; const path = `/_ml/trained_models/${ encodeURIComponent ( params . model_id . toString ( ) ) }/model_aliases/${ encodeURIComponent ( params . model_alias . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async estimateModelMemory ( this , params ? , options ? ) ; async estimateModelMemory ( this , params ? , options ? ) ; async estimateModelMemory ( this , params ? , options ? ) ; async estimateModelMemory ( this , params ? , options ? ) { const acceptedPath = [ ] ; const acceptedBody = [ 'analysis_config' , 'max_bucket_cardinality' , 'overall_cardinality' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } params = params ?? { } ; for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = '/_ml/anomaly_detectors/_estimate_model_memory' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async evaluateDataFrame ( this , params , options ? ) ; async evaluateDataFrame ( this , params , options ? ) ; async evaluateDataFrame ( this , params , options ? ) ; async evaluateDataFrame ( this , params , options ? ) { const acceptedPath = [ ] ; const acceptedBody = [ 'evaluation' , 'index' , 'query' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = '/_ml/data_frame/_evaluate' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async explainDataFrameAnalytics ( this , params ? , options ? ) ; async explainDataFrameAnalytics ( this , params ? , options ? ) ; async explainDataFrameAnalytics ( this , params ? , options ? ) ; async explainDataFrameAnalytics ( this , params ? , options ? ) { const acceptedPath = [ 'id' ] ; const acceptedBody = [ 'source' , 'dest' , 'analysis' , 'description' , 'model_memory_limit' , 'max_num_threads' , 'analyzed_fields' , 'allow_lazy_start' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } params = params ?? { } ; for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } let method = '' ; let path = '' ; if ( params . id != null ) { method = body != null ? 'POST' : 'GET' ; path = `/_ml/data_frame/analytics/${ encodeURIComponent ( params . id . toString ( ) ) }/_explain` ; } else { method = body != null ? 'POST' : 'GET' ; path = '/_ml/data_frame/analytics/_explain' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async flushJob ( this , params , options ? ) ; async flushJob ( this , params , options ? ) ; async flushJob ( this , params , options ? ) ; async flushJob ( this , params , options ? ) { const acceptedPath = [ 'job_id' ] ; const acceptedBody = [ 'advance_time' , 'calc_interim' , 'end' , 'skip_time' , 'start' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = `/_ml/anomaly_detectors/${ encodeURIComponent ( params . job_id . toString ( ) ) }/_flush` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async forecast ( this , params , options ? ) ; async forecast ( this , params , options ? ) ; async forecast ( this , params , options ? ) ; async forecast ( this , params , options ? ) { const acceptedPath = [ 'job_id' ] ; const acceptedBody = [ 'duration' , 'expires_in' , 'max_model_memory' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = `/_ml/anomaly_detectors/${ encodeURIComponent ( params . job_id . toString ( ) ) }/_forecast` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getBuckets ( this , params , options ? ) ; async getBuckets ( this , params , options ? ) ; async getBuckets ( this , params , options ? ) ; async getBuckets ( this , params , options ? ) { const acceptedPath = [ 'job_id' , 'timestamp' ] ; const acceptedBody = [ 'anomaly_score' , 'desc' , 'end' , 'exclude_interim' , 'expand' , 'page' , 'sort' , 'start' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } let method = '' ; let path = '' ; if ( params . job_id != null && params . timestamp != null ) { method = body != null ? 'POST' : 'GET' ; path = `/_ml/anomaly_detectors/${ encodeURIComponent ( params . job_id . toString ( ) ) }/results/buckets/${ encodeURIComponent ( params . timestamp . toString ( ) ) }` ; } else { method = body != null ? 'POST' : 'GET' ; path = `/_ml/anomaly_detectors/${ encodeURIComponent ( params . job_id . toString ( ) ) }/results/buckets` ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getCalendarEvents ( this , params , options ? ) ; async getCalendarEvents ( this , params , options ? ) ; async getCalendarEvents ( this , params , options ? ) ; async getCalendarEvents ( this , params , options ? ) { const acceptedPath = [ 'calendar_id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'GET' ; const path = `/_ml/calendars/${ encodeURIComponent ( params . calendar_id . toString ( ) ) }/events` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getCalendars ( this , params ? , options ? ) ; async getCalendars ( this , params ? , options ? ) ; async getCalendars ( this , params ? , options ? ) ; async getCalendars ( this , params ? , options ? ) { const acceptedPath = [ 'calendar_id' ] ; const acceptedBody = [ 'page' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } params = params ?? { } ; for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } let method = '' ; let path = '' ; if ( params . calendar_id != null ) { method = body != null ? 'POST' : 'GET' ; path = `/_ml/calendars/${ encodeURIComponent ( params . calendar_id . toString ( ) ) }` ; } else { method = body != null ? 'POST' : 'GET' ; path = '/_ml/calendars' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getCategories ( this , params , options ? ) ; async getCategories ( this , params , options ? ) ; async getCategories ( this , params , options ? ) ; async getCategories ( this , params , options ? ) { const acceptedPath = [ 'job_id' , 'category_id' ] ; const acceptedBody = [ 'page' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } let method = '' ; let path = '' ; if ( params . job_id != null && params . category_id != null ) { method = body != null ? 'POST' : 'GET' ; path = `/_ml/anomaly_detectors/${ encodeURIComponent ( params . job_id . toString ( ) ) }/results/categories/${ encodeURIComponent ( params . category_id . toString ( ) ) }` ; } else { method = body != null ? 'POST' : 'GET' ; path = `/_ml/anomaly_detectors/${ encodeURIComponent ( params . job_id . toString ( ) ) }/results/categories/` ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getDataFrameAnalytics ( this , params ? , options ? ) ; async getDataFrameAnalytics ( this , params ? , options ? ) ; async getDataFrameAnalytics ( this , params ? , options ? ) ; async getDataFrameAnalytics ( this , params ? , options ? ) { const acceptedPath = [ 'id' ] ; const querystring = { } ; const body = undefined ; params = params ?? { } ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } let method = '' ; let path = '' ; if ( params . id != null ) { method = 'GET' ; path = `/_ml/data_frame/analytics/${ encodeURIComponent ( params . id . toString ( ) ) }` ; } else { method = 'GET' ; path = '/_ml/data_frame/analytics' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getDataFrameAnalyticsStats ( this , params ? , options ? ) ; async getDataFrameAnalyticsStats ( this , params ? , options ? ) ; async getDataFrameAnalyticsStats ( this , params ? , options ? ) ; async getDataFrameAnalyticsStats ( this , params ? , options ? ) { const acceptedPath = [ 'id' ] ; const querystring = { } ; const body = undefined ; params = params ?? { } ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } let method = '' ; let path = '' ; if ( params . id != null ) { method = 'GET' ; path = `/_ml/data_frame/analytics/${ encodeURIComponent ( params . id . toString ( ) ) }/_stats` ; } else { method = 'GET' ; path = '/_ml/data_frame/analytics/_stats' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getDatafeedStats ( this , params ? , options ? ) ; async getDatafeedStats ( this , params ? , options ? ) ; async getDatafeedStats ( this , params ? , options ? ) ; async getDatafeedStats ( this , params ? , options ? ) { const acceptedPath = [ 'datafeed_id' ] ; const querystring = { } ; const body = undefined ; params = params ?? { } ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } let method = '' ; let path = '' ; if ( params . datafeed_id != null ) { method = 'GET' ; path = `/_ml/datafeeds/${ encodeURIComponent ( params . datafeed_id . toString ( ) ) }/_stats` ; } else { method = 'GET' ; path = '/_ml/datafeeds/_stats' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getDatafeeds ( this , params ? , options ? ) ; async getDatafeeds ( this , params ? , options ? ) ; async getDatafeeds ( this , params ? , options ? ) ; async getDatafeeds ( this , params ? , options ? ) { const acceptedPath = [ 'datafeed_id' ] ; const querystring = { } ; const body = undefined ; params = params ?? { } ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } let method = '' ; let path = '' ; if ( params . datafeed_id != null ) { method = 'GET' ; path = `/_ml/datafeeds/${ encodeURIComponent ( params . datafeed_id . toString ( ) ) }` ; } else { method = 'GET' ; path = '/_ml/datafeeds' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getFilters ( this , params ? , options ? ) ; async getFilters ( this , params ? , options ? ) ; async getFilters ( this , params ? , options ? ) ; async getFilters ( this , params ? , options ? ) { const acceptedPath = [ 'filter_id' ] ; const querystring = { } ; const body = undefined ; params = params ?? { } ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } let method = '' ; let path = '' ; if ( params . filter_id != null ) { method = 'GET' ; path = `/_ml/filters/${ encodeURIComponent ( params . filter_id . toString ( ) ) }` ; } else { method = 'GET' ; path = '/_ml/filters' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getInfluencers ( this , params , options ? ) ; async getInfluencers ( this , params , options ? ) ; async getInfluencers ( this , params , options ? ) ; async getInfluencers ( this , params , options ? ) { const acceptedPath = [ 'job_id' ] ; const acceptedBody = [ 'page' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = body != null ? 'POST' : 'GET' ; const path = `/_ml/anomaly_detectors/${ encodeURIComponent ( params . job_id . toString ( ) ) }/results/influencers` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getJobStats ( this , params ? , options ? ) ; async getJobStats ( this , params ? , options ? ) ; async getJobStats ( this , params ? , options ? ) ; async getJobStats ( this , params ? , options ? ) { const acceptedPath = [ 'job_id' ] ; const querystring = { } ; const body = undefined ; params = params ?? { } ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } let method = '' ; let path = '' ; if ( params . job_id != null ) { method = 'GET' ; path = `/_ml/anomaly_detectors/${ encodeURIComponent ( params . job_id . toString ( ) ) }/_stats` ; } else { method = 'GET' ; path = '/_ml/anomaly_detectors/_stats' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getJobs ( this , params ? , options ? ) ; async getJobs ( this , params ? , options ? ) ; async getJobs ( this , params ? , options ? ) ; async getJobs ( this , params ? , options ? ) { const acceptedPath = [ 'job_id' ] ; const querystring = { } ; const body = undefined ; params = params ?? { } ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } let method = '' ; let path = '' ; if ( params . job_id != null ) { method = 'GET' ; path = `/_ml/anomaly_detectors/${ encodeURIComponent ( params . job_id . toString ( ) ) }` ; } else { method = 'GET' ; path = '/_ml/anomaly_detectors' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getModelSnapshotUpgradeStats ( this , params ? , options ? ) ; async getModelSnapshotUpgradeStats ( this , params ? , options ? ) ; async getModelSnapshotUpgradeStats ( this , params ? , options ? ) ; async getModelSnapshotUpgradeStats ( this , params ? , options ? ) { const acceptedPath = [ 'job_id' , 'snapshot_id' ] ; const querystring = { } ; const body = undefined ; params = params ?? { } ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'GET' ; const path = `/_ml/anomaly_detectors/${ encodeURIComponent ( params . job_id . toString ( ) ) }/model_snapshots/${ encodeURIComponent ( params . snapshot_id . toString ( ) ) }/_upgrade/_stats` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getModelSnapshots ( this , params , options ? ) ; async getModelSnapshots ( this , params , options ? ) ; async getModelSnapshots ( this , params , options ? ) ; async getModelSnapshots ( this , params , options ? ) { const acceptedPath = [ 'job_id' , 'snapshot_id' ] ; const acceptedBody = [ 'desc' , 'end' , 'page' , 'sort' , 'start' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } let method = '' ; let path = '' ; if ( params . job_id != null && params . snapshot_id != null ) { method = body != null ? 'POST' : 'GET' ; path = `/_ml/anomaly_detectors/${ encodeURIComponent ( params . job_id . toString ( ) ) }/model_snapshots/${ encodeURIComponent ( params . snapshot_id . toString ( ) ) }` ; } else { method = body != null ? 'POST' : 'GET' ; path = `/_ml/anomaly_detectors/${ encodeURIComponent ( params . job_id . toString ( ) ) }/model_snapshots` ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getOverallBuckets ( this , params , options ? ) ; async getOverallBuckets ( this , params , options ? ) ; async getOverallBuckets ( this , params , options ? ) ; async getOverallBuckets ( this , params , options ? ) { const acceptedPath = [ 'job_id' ] ; const acceptedBody = [ 'allow_no_match' , 'bucket_span' , 'end' , 'exclude_interim' , 'overall_score' , 'start' , 'top_n' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = body != null ? 'POST' : 'GET' ; const path = `/_ml/anomaly_detectors/${ encodeURIComponent ( params . job_id . toString ( ) ) }/results/overall_buckets` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getRecords ( this , params , options ? ) ; async getRecords ( this , params , options ? ) ; async getRecords ( this , params , options ? ) ; async getRecords ( this , params , options ? ) { const acceptedPath = [ 'job_id' ] ; const acceptedBody = [ 'desc' , 'end' , 'exclude_interim' , 'page' , 'record_score' , 'sort' , 'start' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = body != null ? 'POST' : 'GET' ; const path = `/_ml/anomaly_detectors/${ encodeURIComponent ( params . job_id . toString ( ) ) }/results/records` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getTrainedModels ( this , params ? , options ? ) ; async getTrainedModels ( this , params ? , options ? ) ; async getTrainedModels ( this , params ? , options ? ) ; async getTrainedModels ( this , params ? , options ? ) { const acceptedPath = [ 'model_id' ] ; const querystring = { } ; const body = undefined ; params = params ?? { } ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } let method = '' ; let path = '' ; if ( params . model_id != null ) { method = 'GET' ; path = `/_ml/trained_models/${ encodeURIComponent ( params . model_id . toString ( ) ) }` ; } else { method = 'GET' ; path = '/_ml/trained_models' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getTrainedModelsStats ( this , params ? , options ? ) ; async getTrainedModelsStats ( this , params ? , options ? ) ; async getTrainedModelsStats ( this , params ? , options ? ) ; async getTrainedModelsStats ( this , params ? , options ? ) { const acceptedPath = [ 'model_id' ] ; const querystring = { } ; const body = undefined ; params = params ?? { } ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } let method = '' ; let path = '' ; if ( params . model_id != null ) { method = 'GET' ; path = `/_ml/trained_models/${ encodeURIComponent ( params . model_id . toString ( ) ) }/_stats` ; } else { method = 'GET' ; path = '/_ml/trained_models/_stats' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async inferTrainedModelDeployment ( this , params , options ? ) ; async inferTrainedModelDeployment ( this , params , options ? ) ; async inferTrainedModelDeployment ( this , params , options ? ) ; async inferTrainedModelDeployment ( this , params , options ? ) { const acceptedPath = [ 'model_id' ] ; const acceptedBody = [ 'docs' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = `/_ml/trained_models/${ encodeURIComponent ( params . model_id . toString ( ) ) }/deployment/_infer` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async info ( this , params ? , options ? ) ; async info ( this , params ? , options ? ) ; async info ( this , params ? , options ? ) ; async info ( this , params ? , options ? ) { const acceptedPath = [ ] ; const querystring = { } ; const body = undefined ; params = params ?? { } ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'GET' ; const path = '/_ml/info' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async openJob ( this , params , options ? ) ; async openJob ( this , params , options ? ) ; async openJob ( this , params , options ? ) ; async openJob ( this , params , options ? ) { const acceptedPath = [ 'job_id' ] ; const acceptedBody = [ 'timeout' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = `/_ml/anomaly_detectors/${ encodeURIComponent ( params . job_id . toString ( ) ) }/_open` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async postCalendarEvents ( this , params , options ? ) ; async postCalendarEvents ( this , params , options ? ) ; async postCalendarEvents ( this , params , options ? ) ; async postCalendarEvents ( this , params , options ? ) { const acceptedPath = [ 'calendar_id' ] ; const acceptedBody = [ 'events' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = `/_ml/calendars/${ encodeURIComponent ( params . calendar_id . toString ( ) ) }/events` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async postData < TData = unknown > ( this , params , options ? ) ; async postData < TData = unknown > ( this , params , options ? ) ; async postData < TData = unknown > ( this , params , options ? ) ; async postData < TData = unknown > ( this , params , options ? ) { const acceptedPath = [ 'job_id' ] ; const acceptedBody = [ 'data' ] ; const querystring = { } ; let body = params . body ?? undefined ; for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = `/_ml/anomaly_detectors/${ encodeURIComponent ( params . job_id . toString ( ) ) }/_data` ; return await this . transport . request ( { path , method , querystring , bulkBody : body } , options ) ; } async previewDataFrameAnalytics ( this , params ? , options ? ) ; async previewDataFrameAnalytics ( this , params ? , options ? ) ; async previewDataFrameAnalytics ( this , params ? , options ? ) ; async previewDataFrameAnalytics ( this , params ? , options ? ) { const acceptedPath = [ 'id' ] ; const acceptedBody = [ 'config' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } params = params ?? { } ; for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } let method = '' ; let path = '' ; if ( params . id != null ) { method = body != null ? 'POST' : 'GET' ; path = `/_ml/data_frame/analytics/${ encodeURIComponent ( params . id . toString ( ) ) }/_preview` ; } else { method = body != null ? 'POST' : 'GET' ; path = '/_ml/data_frame/analytics/_preview' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async previewDatafeed < TDocument = unknown > ( this , params ? , options ? ) ; async previewDatafeed < TDocument = unknown > ( this , params ? , options ? ) ; async previewDatafeed < TDocument = unknown > ( this , params ? , options ? ) ; async previewDatafeed < TDocument = unknown > ( this , params ? , options ? ) { const acceptedPath = [ 'datafeed_id' ] ; const acceptedBody = [ 'datafeed_config' , 'job_config' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } params = params ?? { } ; for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } let method = '' ; let path = '' ; if ( params . datafeed_id != null ) { method = body != null ? 'POST' : 'GET' ; path = `/_ml/datafeeds/${ encodeURIComponent ( params . datafeed_id . toString ( ) ) }/_preview` ; } else { method = body != null ? 'POST' : 'GET' ; path = '/_ml/datafeeds/_preview' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async putCalendar ( this , params , options ? ) ; async putCalendar ( this , params , options ? ) ; async putCalendar ( this , params , options ? ) ; async putCalendar ( this , params , options ? ) { const acceptedPath = [ 'calendar_id' ] ; const acceptedBody = [ 'job_ids' , 'description' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'PUT' ; const path = `/_ml/calendars/${ encodeURIComponent ( params . calendar_id . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async putCalendarJob ( this , params , options ? ) ; async putCalendarJob ( this , params , options ? ) ; async putCalendarJob ( this , params , options ? ) ; async putCalendarJob ( this , params , options ? ) { const acceptedPath = [ 'calendar_id' , 'job_id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'PUT' ; const path = `/_ml/calendars/${ encodeURIComponent ( params . calendar_id . toString ( ) ) }/jobs/${ encodeURIComponent ( params . job_id . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async putDataFrameAnalytics ( this , params , options ? ) ; async putDataFrameAnalytics ( this , params , options ? ) ; async putDataFrameAnalytics ( this , params , options ? ) ; async putDataFrameAnalytics ( this , params , options ? ) { const acceptedPath = [ 'id' ] ; const acceptedBody = [ 'allow_lazy_start' , 'analysis' , 'analyzed_fields' , 'description' , 'dest' , 'max_num_threads' , 'model_memory_limit' , 'source' , 'headers' , 'version' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'PUT' ; const path = `/_ml/data_frame/analytics/${ encodeURIComponent ( params . id . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async putDatafeed ( this , params , options ? ) ; async putDatafeed ( this , params , options ? ) ; async putDatafeed ( this , params , options ? ) ; async putDatafeed ( this , params , options ? ) { const acceptedPath = [ 'datafeed_id' ] ; const acceptedBody = [ 'aggregations' , 'chunking_config' , 'delayed_data_check_config' , 'frequency' , 'indices' , 'indexes' , 'indices_options' , 'job_id' , 'max_empty_searches' , 'query' , 'query_delay' , 'runtime_mappings' , 'script_fields' , 'scroll_size' , 'headers' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'PUT' ; const path = `/_ml/datafeeds/${ encodeURIComponent ( params . datafeed_id . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async putFilter ( this , params , options ? ) ; async putFilter ( this , params , options ? ) ; async putFilter ( this , params , options ? ) ; async putFilter ( this , params , options ? ) { const acceptedPath = [ 'filter_id' ] ; const acceptedBody = [ 'description' , 'items' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'PUT' ; const path = `/_ml/filters/${ encodeURIComponent ( params . filter_id . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async putJob ( this , params , options ? ) ; async putJob ( this , params , options ? ) ; async putJob ( this , params , options ? ) ; async putJob ( this , params , options ? ) { const acceptedPath = [ 'job_id' ] ; const acceptedBody = [ 'allow_lazy_open' , 'analysis_config' , 'analysis_limits' , 'background_persist_interval' , 'custom_settings' , 'daily_model_snapshot_retention_after_days' , 'data_description' , 'datafeed_config' , 'description' , 'groups' , 'model_plot_config' , 'model_snapshot_retention_days' , 'renormalization_window_days' , 'results_index_name' , 'results_retention_days' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'PUT' ; const path = `/_ml/anomaly_detectors/${ encodeURIComponent ( params . job_id . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async putTrainedModel ( this , params , options ? ) ; async putTrainedModel ( this , params , options ? ) ; async putTrainedModel ( this , params , options ? ) ; async putTrainedModel ( this , params , options ? ) { const acceptedPath = [ 'model_id' ] ; const acceptedBody = [ 'compressed_definition' , 'definition' , 'description' , 'inference_config' , 'input' , 'metadata' , 'model_type' , 'model_size_bytes' , 'tags' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'PUT' ; const path = `/_ml/trained_models/${ encodeURIComponent ( params . model_id . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async putTrainedModelAlias ( this , params , options ? ) ; async putTrainedModelAlias ( this , params , options ? ) ; async putTrainedModelAlias ( this , params , options ? ) ; async putTrainedModelAlias ( this , params , options ? ) { const acceptedPath = [ 'model_alias' , 'model_id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'PUT' ; const path = `/_ml/trained_models/${ encodeURIComponent ( params . model_id . toString ( ) ) }/model_aliases/${ encodeURIComponent ( params . model_alias . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async putTrainedModelDefinitionPart ( this , params , options ? ) ; async putTrainedModelDefinitionPart ( this , params , options ? ) ; async putTrainedModelDefinitionPart ( this , params , options ? ) ; async putTrainedModelDefinitionPart ( this , params , options ? ) { const acceptedPath = [ 'model_id' , 'part' ] ; const acceptedBody = [ 'definition' , 'total_definition_length' , 'total_parts' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'PUT' ; const path = `/_ml/trained_models/${ encodeURIComponent ( params . model_id . toString ( ) ) }/definition/${ encodeURIComponent ( params . part . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async putTrainedModelVocabulary ( this , params , options ? ) ; async putTrainedModelVocabulary ( this , params , options ? ) ; async putTrainedModelVocabulary ( this , params , options ? ) ; async putTrainedModelVocabulary ( this , params , options ? ) { const acceptedPath = [ 'model_id' ] ; const acceptedBody = [ 'vocabulary' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'PUT' ; const path = `/_ml/trained_models/${ encodeURIComponent ( params . model_id . toString ( ) ) }/vocabulary` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async resetJob ( this , params , options ? ) ; async resetJob ( this , params , options ? ) ; async resetJob ( this , params , options ? ) ; async resetJob ( this , params , options ? ) { const acceptedPath = [ 'job_id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = `/_ml/anomaly_detectors/${ encodeURIComponent ( params . job_id . toString ( ) ) }/_reset` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async revertModelSnapshot ( this , params , options ? ) ; async revertModelSnapshot ( this , params , options ? ) ; async revertModelSnapshot ( this , params , options ? ) ; async revertModelSnapshot ( this , params , options ? ) { const acceptedPath = [ 'job_id' , 'snapshot_id' ] ; const acceptedBody = [ 'delete_intervening_results' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = `/_ml/anomaly_detectors/${ encodeURIComponent ( params . job_id . toString ( ) ) }/model_snapshots/${ encodeURIComponent ( params . snapshot_id . toString ( ) ) }/_revert` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async setUpgradeMode ( this , params ? , options ? ) ; async setUpgradeMode ( this , params ? , options ? ) ; async setUpgradeMode ( this , params ? , options ? ) ; async setUpgradeMode ( this , params ? , options ? ) { const acceptedPath = [ ] ; const querystring = { } ; const body = undefined ; params = params ?? { } ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = '/_ml/set_upgrade_mode' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async startDataFrameAnalytics ( this , params , options ? ) ; async startDataFrameAnalytics ( this , params , options ? ) ; async startDataFrameAnalytics ( this , params , options ? ) ; async startDataFrameAnalytics ( this , params , options ? ) { const acceptedPath = [ 'id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = `/_ml/data_frame/analytics/${ encodeURIComponent ( params . id . toString ( ) ) }/_start` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async startDatafeed ( this , params , options ? ) ; async startDatafeed ( this , params , options ? ) ; async startDatafeed ( this , params , options ? ) ; async startDatafeed ( this , params , options ? ) { const acceptedPath = [ 'datafeed_id' ] ; const acceptedBody = [ 'end' , 'start' , 'timeout' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = `/_ml/datafeeds/${ encodeURIComponent ( params . datafeed_id . toString ( ) ) }/_start` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async startTrainedModelDeployment ( this , params , options ? ) ; async startTrainedModelDeployment ( this , params , options ? ) ; async startTrainedModelDeployment ( this , params , options ? ) ; async startTrainedModelDeployment ( this , params , options ? ) { const acceptedPath = [ 'model_id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = `/_ml/trained_models/${ encodeURIComponent ( params . model_id . toString ( ) ) }/deployment/_start` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async stopDataFrameAnalytics ( this , params , options ? ) ; async stopDataFrameAnalytics ( this , params , options ? ) ; async stopDataFrameAnalytics ( this , params , options ? ) ; async stopDataFrameAnalytics ( this , params , options ? ) { const acceptedPath = [ 'id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = `/_ml/data_frame/analytics/${ encodeURIComponent ( params . id . toString ( ) ) }/_stop` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async stopDatafeed ( this , params , options ? ) ; async stopDatafeed ( this , params , options ? ) ; async stopDatafeed ( this , params , options ? ) ; async stopDatafeed ( this , params , options ? ) { const acceptedPath = [ 'datafeed_id' ] ; const acceptedBody = [ 'allow_no_match' , 'force' , 'timeout' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = `/_ml/datafeeds/${ encodeURIComponent ( params . datafeed_id . toString ( ) ) }/_stop` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async stopTrainedModelDeployment ( this , params , options ? ) ; async stopTrainedModelDeployment ( this , params , options ? ) ; async stopTrainedModelDeployment ( this , params , options ? ) ; async stopTrainedModelDeployment ( this , params , options ? ) { const acceptedPath = [ 'model_id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = `/_ml/trained_models/${ encodeURIComponent ( params . model_id . toString ( ) ) }/deployment/_stop` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async updateDataFrameAnalytics ( this , params , options ? ) ; async updateDataFrameAnalytics ( this , params , options ? ) ; async updateDataFrameAnalytics ( this , params , options ? ) ; async updateDataFrameAnalytics ( this , params , options ? ) { const acceptedPath = [ 'id' ] ; const acceptedBody = [ 'description' , 'model_memory_limit' , 'max_num_threads' , 'allow_lazy_start' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = `/_ml/data_frame/analytics/${ encodeURIComponent ( params . id . toString ( ) ) }/_update` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async updateDatafeed ( this , params , options ? ) ; async updateDatafeed ( this , params , options ? ) ; async updateDatafeed ( this , params , options ? ) ; async updateDatafeed ( this , params , options ? ) { const acceptedPath = [ 'datafeed_id' ] ; const acceptedBody = [ 'aggregations' , 'chunking_config' , 'delayed_data_check_config' , 'frequency' , 'indices' , 'indexes' , 'indices_options' , 'max_empty_searches' , 'query' , 'query_delay' , 'runtime_mappings' , 'script_fields' , 'scroll_size' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = `/_ml/datafeeds/${ encodeURIComponent ( params . datafeed_id . toString ( ) ) }/_update` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async updateFilter ( this , params , options ? ) ; async updateFilter ( this , params , options ? ) ; async updateFilter ( this , params , options ? ) ; async updateFilter ( this , params , options ? ) { const acceptedPath = [ 'filter_id' ] ; const acceptedBody = [ 'add_items' , 'description' , 'remove_items' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = `/_ml/filters/${ encodeURIComponent ( params . filter_id . toString ( ) ) }/_update` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async updateJob ( this , params , options ? ) ; async updateJob ( this , params , options ? ) ; async updateJob ( this , params , options ? ) ; async updateJob ( this , params , options ? ) { const acceptedPath = [ 'job_id' ] ; const acceptedBody = [ 'allow_lazy_open' , 'analysis_limits' , 'background_persist_interval' , 'custom_settings' , 'categorization_filters' , 'description' , 'model_plot_config' , 'daily_model_snapshot_retention_after_days' , 'model_snapshot_retention_days' , 'renormalization_window_days' , 'results_retention_days' , 'groups' , 'detectors' , 'per_partition_categorization' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = `/_ml/anomaly_detectors/${ encodeURIComponent ( params . job_id . toString ( ) ) }/_update` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async updateModelSnapshot ( this , params , options ? ) ; async updateModelSnapshot ( this , params , options ? ) ; async updateModelSnapshot ( this , params , options ? ) ; async updateModelSnapshot ( this , params , options ? ) { const acceptedPath = [ 'job_id' , 'snapshot_id' ] ; const acceptedBody = [ 'description' , 'retain' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = `/_ml/anomaly_detectors/${ encodeURIComponent ( params . job_id . toString ( ) ) }/model_snapshots/${ encodeURIComponent ( params . snapshot_id . toString ( ) ) }/_update` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async upgradeJobSnapshot ( this , params , options ? ) ; async upgradeJobSnapshot ( this , params , options ? ) ; async upgradeJobSnapshot ( this , params , options ? ) ; async upgradeJobSnapshot ( this , params , options ? ) { const acceptedPath = [ 'job_id' , 'snapshot_id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = `/_ml/anomaly_detectors/${ encodeURIComponent ( params . job_id . toString ( ) ) }/model_snapshots/${ encodeURIComponent ( params . snapshot_id . toString ( ) ) }/_upgrade` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async validate ( this , params ? , options ? ) ; async validate ( this , params ? , options ? ) ; async validate ( this , params ? , options ? ) ; async validate ( this , params ? , options ? ) { const acceptedPath = [ ] ; const acceptedBody = [ 'job_id' , 'analysis_config' , 'analysis_limits' , 'data_description' , 'description' , 'model_plot' , 'model_snapshot_id' , 'model_snapshot_retention_days' , 'results_index_name' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } params = params ?? { } ; for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = '/_ml/anomaly_detectors/_validate' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async validateDetector ( this , params , options ? ) ; async validateDetector ( this , params , options ? ) ; async validateDetector ( this , params , options ? ) ; async validateDetector ( this , params , options ? ) { const acceptedPath = [ ] ; const acceptedBody = [ 'detector' ] ; const querystring = { } ; let body = params . body ?? undefined ; for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = '/_ml/anomaly_detectors/_validate/detector' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } }