Update trained model deployment APIedit

Updates certain properties of a trained model deployment.

This functionality is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.


POST _ml/trained_models/<deployment_id>/deployment/_update


Requires the manage_ml cluster privilege. This privilege is included in the machine_learning_admin built-in role.


You 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 parametersedit

(Required, string) A unique identifier for the deployment of the model.

Request bodyedit

(Optional, integer) The total number of allocations this model is assigned across machine learning nodes. Increasing this value generally increases the throughput.


The 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(
    body={"number_of_allocations": 4},
response = client.ml.update_trained_model_deployment(
  model_id: 'elastic__distilbert-base-uncased-finetuned-conll03-english',
  body: {
    number_of_allocations: 4
puts 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"