Update trained model deployment APIedit

Updates certain properties of a trained model deployment.

Requestedit

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

Prerequisitesedit

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

Descriptionedit

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

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

Request bodyedit

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.

Examplesedit

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(
    model_id="elastic__distilbert-base-uncased-finetuned-conll03-english",
    body={"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
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"
    }
}