API generation
This commit is contained in:
81
api/api/ml.put_trained_model.js
Normal file
81
api/api/ml.put_trained_model.js
Normal file
@ -0,0 +1,81 @@
|
||||
// Licensed to Elasticsearch B.V under one or more agreements.
|
||||
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
||||
// See the LICENSE file in the project root for more information
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildMlPutTrainedModel (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
|
||||
|
||||
const acceptedQuerystring = [
|
||||
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a ml.put_trained_model request
|
||||
* TODO
|
||||
*/
|
||||
return function mlPutTrainedModel (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['model_id'] == null && params['modelId'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: model_id or modelId')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['body'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = []
|
||||
var { method, body, modelId, model_id, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
|
||||
|
||||
var ignore = options.ignore
|
||||
if (typeof ignore === 'number') {
|
||||
options.ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if (method == null) method = 'PUT'
|
||||
path = '/' + '_ml' + '/' + 'inference' + '/' + encodeURIComponent(model_id || modelId)
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildMlPutTrainedModel
|
||||
@ -360,6 +360,8 @@ function ESAPI (opts) {
|
||||
putFilter: lazyLoad('ml.put_filter', opts),
|
||||
put_job: lazyLoad('ml.put_job', opts),
|
||||
putJob: lazyLoad('ml.put_job', opts),
|
||||
put_trained_model: lazyLoad('ml.put_trained_model', opts),
|
||||
putTrainedModel: lazyLoad('ml.put_trained_model', opts),
|
||||
revert_model_snapshot: lazyLoad('ml.revert_model_snapshot', opts),
|
||||
revertModelSnapshot: lazyLoad('ml.revert_model_snapshot', opts),
|
||||
set_upgrade_mode: lazyLoad('ml.set_upgrade_mode', opts),
|
||||
|
||||
5
api/requestParams.d.ts
vendored
5
api/requestParams.d.ts
vendored
@ -1855,6 +1855,11 @@ export interface MlPutJob<T = any> extends Generic {
|
||||
body: T;
|
||||
}
|
||||
|
||||
export interface MlPutTrainedModel<T = any> extends Generic {
|
||||
model_id: string;
|
||||
body: T;
|
||||
}
|
||||
|
||||
export interface MlRevertModelSnapshot<T = any> extends Generic {
|
||||
job_id: string;
|
||||
snapshot_id: string;
|
||||
|
||||
@ -1,4 +1,37 @@
|
||||
[[api-reference]]
|
||||
|
||||
////////
|
||||
|
||||
|
||||
|
||||
===========================================================================================================================
|
||||
|| ||
|
||||
|| ||
|
||||
|| ||
|
||||
|| ██████╗ ███████╗ █████╗ ██████╗ ███╗ ███╗███████╗ ||
|
||||
|| ██╔══██╗██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝ ||
|
||||
|| ██████╔╝█████╗ ███████║██║ ██║██╔████╔██║█████╗ ||
|
||||
|| ██╔══██╗██╔══╝ ██╔══██║██║ ██║██║╚██╔╝██║██╔══╝ ||
|
||||
|| ██║ ██║███████╗██║ ██║██████╔╝██║ ╚═╝ ██║███████╗ ||
|
||||
|| ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝╚══════╝ ||
|
||||
|| ||
|
||||
|| ||
|
||||
|| This file is autogenerated, DO NOT send pull requests that changes this file directly. ||
|
||||
|| You should update the script that does the generation, which can be found in '/scripts/utils/generateDocs.js'. ||
|
||||
|| ||
|
||||
|| You can run the script with the following command: ||
|
||||
|| node scripts/generate --branch <branch_name> ||
|
||||
|| or ||
|
||||
|| node scripts/generate --tag <tag_name> ||
|
||||
|| ||
|
||||
|| ||
|
||||
|| ||
|
||||
===========================================================================================================================
|
||||
|
||||
|
||||
|
||||
////////
|
||||
|
||||
== API Reference
|
||||
|
||||
This document contains the entire list of the Elasticsearch API supported by the client, both OSS and commercial. The client is entirely licensed under Apache 2.0.
|
||||
@ -37,14 +70,7 @@ client.search({
|
||||
|
||||
In this document, you will find the reference of every parameter accepted by the querystring or the url. If you also need to send the body, you can find the documentation of its format in the reference link that is present along with every endpoint.
|
||||
|
||||
////////
|
||||
|
||||
This documentation is generated by running:
|
||||
node scripts/run.js --tag tagName
|
||||
or
|
||||
node scripts/run.js --branch branchName
|
||||
|
||||
////////
|
||||
|
||||
=== Common parameters
|
||||
Parameters that are accepted by all API endpoints.
|
||||
@ -5975,7 +6001,7 @@ _Default:_ `closed`
|
||||
|===
|
||||
|
||||
=== indices.reloadSearchAnalyzers
|
||||
*Stability:* experimental
|
||||
|
||||
[source,ts]
|
||||
----
|
||||
client.indices.reloadSearchAnalyzers({
|
||||
@ -7366,6 +7392,26 @@ link:{ref}/ml-put-job.html[Reference]
|
||||
|
||||
|===
|
||||
|
||||
=== ml.putTrainedModel
|
||||
*Stability:* experimental
|
||||
[source,ts]
|
||||
----
|
||||
client.ml.putTrainedModel({
|
||||
model_id: string,
|
||||
body: object
|
||||
})
|
||||
----
|
||||
link:TODO[Reference]
|
||||
[cols=2*]
|
||||
|===
|
||||
|`model_id` or `modelId`
|
||||
|`string` - The ID of the trained models to store
|
||||
|
||||
|`body`
|
||||
|`object` - The trained model configuration
|
||||
|
||||
|===
|
||||
|
||||
=== ml.revertModelSnapshot
|
||||
|
||||
[source,ts]
|
||||
|
||||
2
index.d.ts
vendored
2
index.d.ts
vendored
@ -459,6 +459,8 @@ declare class Client extends EventEmitter {
|
||||
putFilter: ApiMethod<RequestParams.MlPutFilter>
|
||||
put_job: ApiMethod<RequestParams.MlPutJob>
|
||||
putJob: ApiMethod<RequestParams.MlPutJob>
|
||||
put_trained_model: ApiMethod<RequestParams.MlPutTrainedModel>
|
||||
putTrainedModel: ApiMethod<RequestParams.MlPutTrainedModel>
|
||||
revert_model_snapshot: ApiMethod<RequestParams.MlRevertModelSnapshot>
|
||||
revertModelSnapshot: ApiMethod<RequestParams.MlRevertModelSnapshot>
|
||||
set_upgrade_mode: ApiMethod<RequestParams.MlSetUpgradeMode>
|
||||
|
||||
Reference in New Issue
Block a user