IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Update trained model deployment API
editUpdate trained model deployment API
editUpdates certain properties of a trained model deployment.
Request
editPOST _ml/trained_models/<deployment_id>/deployment/_update
Prerequisites
editRequires the manage_ml
cluster privilege. This privilege is included in the
machine_learning_admin
built-in role.
Description
editYou can update a trained model deployment whose assignment_state
is started
.
You can either increase or decrease the number of allocations of such a deployment.
Path parameters
edit-
<deployment_id>
- (Required, string) A unique identifier for the deployment of the model.
Request body
edit-
number_of_allocations
- (Optional, integer) The total number of allocations this model is assigned across machine learning nodes. Increasing this value generally increases the throughput.
Examples
editThe following example updates the deployment for a
elastic__distilbert-base-uncased-finetuned-conll03-english
trained model to have 4 allocations:
resp = client.ml.update_trained_model_deployment( model_id="elastic__distilbert-base-uncased-finetuned-conll03-english", number_of_allocations=4, ) print(resp)
response = client.ml.update_trained_model_deployment( model_id: 'elastic__distilbert-base-uncased-finetuned-conll03-english', body: { number_of_allocations: 4 } ) puts response
const response = await client.ml.updateTrainedModelDeployment({ model_id: "elastic__distilbert-base-uncased-finetuned-conll03-english", number_of_allocations: 4, }); console.log(response);
POST _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/_update { "number_of_allocations": 4 }
The API returns the following results:
{ "assignment": { "task_parameters": { "model_id": "elastic__distilbert-base-uncased-finetuned-conll03-english", "model_bytes": 265632637, "threads_per_allocation" : 1, "number_of_allocations" : 4, "queue_capacity" : 1024 }, "routing_table": { "uckeG3R8TLe2MMNBQ6AGrw": { "current_allocations": 1, "target_allocations": 4, "routing_state": "started", "reason": "" } }, "assignment_state": "started", "start_time": "2022-11-02T11:50:34.766591Z" } }