put-trained-models-aliases.asciidoc 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[put-trained-models-aliases]]
  4. = Create or update trained model aliases API
  5. [subs="attributes"]
  6. ++++
  7. <titleabbrev>Create or update trained model aliases</titleabbrev>
  8. ++++
  9. Creates or updates a trained model alias.
  10. A trained model alias is a logical name used to reference a single trained model.
  11. [[ml-put-trained-models-aliases-request]]
  12. == {api-request-title}
  13. `PUT _ml/trained_models/<model_id>/model_aliases/<model_alias>`
  14. [[ml-put-trained-models-aliases-prereq]]
  15. == {api-prereq-title}
  16. Requires the `manage_ml` cluster privilege. This privilege is included in the
  17. `machine_learning_admin` built-in role.
  18. [[ml-put-trained-models-aliases-desc]]
  19. == {api-description-title}
  20. You can use aliases instead of trained model identifiers to make it easier to
  21. reference your models. For example, you can use aliases in {infer} aggregations
  22. and processors.
  23. An alias must be unique and refer to only a single trained model. However,
  24. you can have multiple aliases for each trained model.
  25. If you use this API to update an alias such that it references a different
  26. trained model ID and the model uses a different type of {dfanalytics}, an error
  27. occurs. For example, this situation occurs if you have a trained model for
  28. {reganalysis} and a trained model for {classanalysis}; you cannot reassign an
  29. alias from one type of trained model to another.
  30. If you use this API to update an alias and there are very few input fields in
  31. common between the old and new trained models for the model alias, the API
  32. returns a warning.
  33. [[ml-put-trained-models-aliases-path-params]]
  34. == {api-path-parms-title}
  35. `model_alias`::
  36. (Required, string)
  37. The alias to create or update. This value cannot end in numbers.
  38. `model_id`::
  39. (Required, string)
  40. The identifier for the trained model that the alias refers to.
  41. [[ml-put-trained-models-aliases-query-params]]
  42. == {api-query-parms-title}
  43. `reassign`::
  44. (Optional, boolean)
  45. Specifies whether the alias gets reassigned to the specified trained model if it
  46. is already assigned to a different model. If the alias is already assigned and
  47. this parameter is `false`, the API returns an error. Defaults to `false`.
  48. [[ml-put-trained-models-aliases-example]]
  49. == {api-examples-title}
  50. [[ml-put-trained-models-aliases-example-new-alias]]
  51. === Create a trained model alias
  52. The following example shows how to create an alias (`flight_delay_model`) for a
  53. trained model (`flight-delay-prediction-1574775339910`):
  54. [source,console]
  55. --------------------------------------------------
  56. PUT _ml/trained_models/flight-delay-prediction-1574775339910/model_aliases/flight_delay_model
  57. --------------------------------------------------
  58. // TEST[skip:setup kibana sample data]
  59. [[ml-put-trained-models-aliases-example-put-alias]]
  60. === Update a trained model alias
  61. The following example shows how to reassign an alias (`flight_delay_model`) to a
  62. different trained model (`flight-delay-prediction-1580004349800`):
  63. [source,console]
  64. --------------------------------------------------
  65. PUT _ml/trained_models/flight-delay-prediction-1580004349800/model_aliases/flight_delay_model?reassign=true
  66. --------------------------------------------------
  67. // TEST[skip:setup kibana sample data]