update-trained-model-deployment.asciidoc 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. [role="xpack"]
  2. [[update-trained-model-deployment]]
  3. = Update trained model deployment API
  4. [subs="attributes"]
  5. ++++
  6. <titleabbrev>Update trained model deployment</titleabbrev>
  7. ++++
  8. Updates certain properties of a trained model deployment.
  9. beta::[]
  10. [[update-trained-model-deployment-request]]
  11. == {api-request-title}
  12. `POST _ml/trained_models/<deployment_id>/deployment/_update`
  13. [[update-trained-model-deployments-prereqs]]
  14. == {api-prereq-title}
  15. Requires the `manage_ml` cluster privilege. This privilege is included in the
  16. `machine_learning_admin` built-in role.
  17. [[update-trained-model-deployment-desc]]
  18. == {api-description-title}
  19. You can update a trained model deployment whose `assignment_state` is `started`.
  20. You can either increase or decrease the number of allocations of such a deployment.
  21. [[update-trained-model-deployments-path-parms]]
  22. == {api-path-parms-title}
  23. `<deployment_id>`::
  24. (Required, string)
  25. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=deployment-id]
  26. [[update-trained-model-deployment-request-body]]
  27. == {api-request-body-title}
  28. `number_of_allocations`::
  29. (Optional, integer)
  30. The total number of allocations this model is assigned across {ml} nodes.
  31. Increasing this value generally increases the throughput.
  32. [[update-trained-model-deployment-example]]
  33. == {api-examples-title}
  34. The following example updates the deployment for a
  35. `elastic__distilbert-base-uncased-finetuned-conll03-english` trained model to have 4 allocations:
  36. [source,console]
  37. --------------------------------------------------
  38. POST _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/_update
  39. {
  40. "number_of_allocations": 4
  41. }
  42. --------------------------------------------------
  43. // TEST[skip:TBD]
  44. The API returns the following results:
  45. [source,console-result]
  46. ----
  47. {
  48. "assignment": {
  49. "task_parameters": {
  50. "model_id": "elastic__distilbert-base-uncased-finetuned-conll03-english",
  51. "model_bytes": 265632637,
  52. "threads_per_allocation" : 1,
  53. "number_of_allocations" : 4,
  54. "queue_capacity" : 1024
  55. },
  56. "routing_table": {
  57. "uckeG3R8TLe2MMNBQ6AGrw": {
  58. "current_allocations": 1,
  59. "target_allocations": 4,
  60. "routing_state": "started",
  61. "reason": ""
  62. }
  63. },
  64. "assignment_state": "started",
  65. "start_time": "2022-11-02T11:50:34.766591Z"
  66. }
  67. }
  68. ----