forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] adds new trained model alias API to simplify trained model updat…
…es and deployments (elastic#68922) A `model_alias` allows trained models to be referred by a user defined moniker. This not only improves the readability and simplicity of numerous API calls, but it allows for simpler deployment and upgrade procedures for trained models. Previously, if you referenced a model ID directly within an ingest pipeline, when you have a new model that performs better than an earlier referenced model, you have to update the pipeline itself. If this model was used in numerous pipelines, ALL those pipelines would have to be updated. When using a `model_alias` in an ingest pipeline, only that `model_alias` needs to be updated. Then, the underlying referenced model will change in place for all ingest pipelines automatically. An additional benefit is that the model referenced is not changed until it is fully loaded into cache, this way throughput is not hampered by changing models.
- Loading branch information
Showing
41 changed files
with
1,966 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
docs/reference/ml/df-analytics/apis/put-trained-models-aliases.asciidoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
[role="xpack"] | ||
[testenv="platinum"] | ||
[[put-trained-models-aliases]] | ||
= Put Trained Models Aliases API | ||
[subs="attributes"] | ||
++++ | ||
<titleabbrev>Put Trained Models Aliases</titleabbrev> | ||
++++ | ||
|
||
Creates a trained models alias. These model aliases can be used instead of the trained model ID | ||
when referencing the model in the stack. Model aliases must be unique, and a trained model can have | ||
more than one model alias referring to it. But a model alias can only refer to a single trained model. | ||
|
||
beta::[] | ||
|
||
[[ml-put-trained-models-aliases-request]] | ||
== {api-request-title} | ||
|
||
`PUT _ml/trained_models/<model_id>/model_aliases/<model_alias>` | ||
|
||
|
||
[[ml-put-trained-models-aliases-prereq]] | ||
== {api-prereq-title} | ||
|
||
If the {es} {security-features} are enabled, you must have the following | ||
built-in roles and privileges: | ||
|
||
* `machine_learning_admin` | ||
|
||
For more information, see <<built-in-roles>>, <<security-privileges>>, and | ||
{ml-docs-setup-privileges}. | ||
|
||
[[ml-put-trained-models-aliases-desc]] | ||
== {api-description-title} | ||
|
||
This API creates a new model alias to refer to trained models, or updates an existing | ||
trained model's alias. | ||
|
||
When updating an existing model alias to a new model ID, this API will return a error if the models | ||
are of different inference types. Example, if attempting to put the model alias | ||
`flights-delay-prediction` from a regression model to a classification model, the API will error. | ||
|
||
The API will return a warning if there are very few input fields in common between the old | ||
and new models for the model alias. | ||
|
||
[[ml-put-trained-models-aliases-path-params]] | ||
== {api-path-parms-title} | ||
|
||
`model_id`:: | ||
(Required, string) | ||
The trained model ID to which the model alias should refer. | ||
|
||
`model_alias`:: | ||
(Required, string) | ||
The model alias to create or update. The model_alias cannot end in numbers. | ||
|
||
[[ml-put-trained-models-aliases-query-params]] | ||
== {api-query-parms-title} | ||
|
||
`reassign`:: | ||
(Optional, boolean) | ||
Should the `model_alias` get reassigned to the provided `model_id` if it is already | ||
assigned to a model. Defaults to false. The API will return an error if the `model_alias` | ||
is already assigned to a model but this parameter is `false`. | ||
|
||
[[ml-put-trained-models-aliases-example]] | ||
== {api-examples-title} | ||
|
||
[[ml-put-trained-models-aliases-example-new-alias]] | ||
=== Creating a new model alias | ||
|
||
The following example shows how to create a new model alias for a trained model ID. | ||
|
||
[source,console] | ||
-------------------------------------------------- | ||
PUT _ml/trained_models/flight-delay-prediction-1574775339910/model_aliases/flight_delay_model | ||
-------------------------------------------------- | ||
// TEST[skip:setup kibana sample data] | ||
|
||
[[ml-put-trained-models-aliases-example-put-alias]] | ||
=== Updating an existing model alias | ||
|
||
The following example shows how to reassign an existing model alias for a trained model ID. | ||
|
||
[source,console] | ||
-------------------------------------------------- | ||
PUT _ml/trained_models/flight-delay-prediction-1580004349800/model_aliases/flight_delay_model?reassign=true | ||
-------------------------------------------------- | ||
// TEST[skip:setup kibana sample data] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.