Update a model

Introduced 2.12

Updates a model based on the model_ID.

For information about user access for this API, see Model access control considerations.

Path and HTTP methods

  1. PUT /_plugins/_ml/models/<model_id>

Request fields

The following table lists the updatable fields. Not all request fields are applicable to all models. To determine whether the field is applicable to your model type, see Register Model API.

FieldData typeDescription
connectorObjectContains specifications for a connector for a model hosted on a third-party platform. For more information, see Creating a connector for a specific model. For information about the updatable fields within a connector, see Update Connector API request fields.
connector_idOptionalThe connector ID of a standalone connector for a model hosted on a third-party platform. For more information, see Standalone connector. To update a standalone connector, you must undeploy the model, update the connector, and then redeploy the model.
descriptionStringThe model description.
is_enabledBooleanSpecifies whether the model is enabled. Disabling the model makes it unavailable for Predict API requests, regardless of the model’s deployment status. Default is true.
model_configObjectThe model’s configuration, including the model_type, embedding_dimension, and framework_type. all_config is an optional JSON string that contains all model configurations. For more information, see The model_config object.
model_group_idStringThe model group ID of the model group to which to register this model.
nameStringThe model name.
rate_limiterObjectLimits the number of times any user can call the Predict API on the model. For more information, see Rate limiting inference calls.
rate_limiter.limitIntegerThe maximum number of times any user can call the Predict API on the model per unit of time. By default, there is no limit on the number of Predict API calls. Once you set a limit, you cannot reset it to no limit. As an alternative, you can specify a high limit value and a small time unit, for example, 1 request per nanosecond.
rate_limiter.unitStringThe unit of time for the rate limiter. Valid values are DAYS, HOURS, MICROSECONDS, MILLISECONDS, MINUTES, NANOSECONDS, and SECONDS.
guardrailsObjectThe guardrails for the model.
interfaceObjectThe interface for the model.

Example request: Disabling a model

  1. PUT /_plugins/_ml/models/MzcIJX8BA7mbufL6DOwl
  2. {
  3. "is_enabled": false
  4. }

copy

Example request: Rate limiting inference calls for a model

The following request limits the number of times you can call the Predict API on the model to 4 Predict API calls per minute:

  1. PUT /_plugins/_ml/models/T_S-cY0BKCJ3ot9qr0aP
  2. {
  3. "rate_limiter": {
  4. "limit": "4",
  5. "unit": "MINUTES"
  6. }
  7. }

copy

Example request: Updating the guardrails

  1. PUT /_plugins/_ml/models/MzcIJX8BA7mbufL6DOwl
  2. {
  3. "guardrails": {
  4. "input_guardrail": {
  5. "stop_words": [
  6. {
  7. "index_name": "updated_stop_words_input",
  8. "source_fields": ["updated_title"]
  9. }
  10. ],
  11. "regex": ["updated_regex1", "updated_regex2"]
  12. },
  13. "output_guardrail": {
  14. "stop_words": [
  15. {
  16. "index_name": "updated_stop_words_output",
  17. "source_fields": ["updated_title"]
  18. }
  19. ],
  20. "regex": ["updated_regex1", "updated_regex2"]
  21. }
  22. }
  23. }

copy

Example response

  1. {
  2. "_index": ".plugins-ml-model",
  3. "_id": "MzcIJX8BA7mbufL6DOwl",
  4. "_version": 10,
  5. "result": "updated",
  6. "_shards": {
  7. "total": 1,
  8. "successful": 1,
  9. "failed": 0
  10. },
  11. "_seq_no": 48,
  12. "_primary_term": 4
  13. }