diff --git a/docs/reference/ml/df-analytics/apis/delete-inference-trained-model.asciidoc b/docs/reference/ml/df-analytics/apis/delete-inference-trained-model.asciidoc new file mode 100644 index 0000000000000..f2fd703dd83da --- /dev/null +++ b/docs/reference/ml/df-analytics/apis/delete-inference-trained-model.asciidoc @@ -0,0 +1,67 @@ +[role="xpack"] +[testenv="basic"] +[[delete-inference]] +=== Delete {infer} trained model API +[subs="attributes"] +++++ +Delete {infer} trained model +++++ + +Deletes an existing trained {infer} model that is currently not referenced by an +ingest pipeline. + +experimental[] + + +[[ml-delete-inference-request]] +==== {api-request-title} + +`DELETE _ml/inference/` + + +[[ml-delete-inference-prereq]] +==== {api-prereq-title} + +* You must have `machine_learning_admin` built-in role to use this API. For more +information, see <> and <>. + + +[[ml-delete-inference-path-params]] +==== {api-path-parms-title} + +``:: +(Optional, string) +include::{docdir}/ml/ml-shared.asciidoc[tag=model-id] + + +[[ml-delete-inference-response-codes]] +==== {api-response-codes-title} + +`409`:: + The code indicates that the trained {infer} model is referenced by an ingest + pipeline and cannot be deleted. + + +[[ml-delete-inference-example]] +==== {api-examples-title} + +The following example deletes the `regression-job-one-1574775307356` trained +model: + +[source,console] +-------------------------------------------------- +DELETE _ml/inference/regression-job-one-1574775307356 +-------------------------------------------------- +// TEST[skip:TBD] + +The API returns the following result: + + +[source,console-result] +---- +{ + "acknowledged" : true +} +---- + + diff --git a/docs/reference/ml/df-analytics/apis/get-inference-trained-model-stats.asciidoc b/docs/reference/ml/df-analytics/apis/get-inference-trained-model-stats.asciidoc new file mode 100644 index 0000000000000..a31dc071640bc --- /dev/null +++ b/docs/reference/ml/df-analytics/apis/get-inference-trained-model-stats.asciidoc @@ -0,0 +1,134 @@ +[role="xpack"] +[testenv="basic"] +[[get-inference-stats]] +=== Get {infer} trained model statistics API +[subs="attributes"] +++++ +Get {infer} trained model stats +++++ + +Retrieves usage information for trained {infer} models. + +experimental[] + + +[[ml-get-inference-stats-request]] +==== {api-request-title} + +`GET _ml/inference/_stats` + + +`GET _ml/inference/_all/_stats` + + +`GET _ml/inference//_stats` + + +`GET _ml/inference/,/_stats` + + +`GET _ml/inference/,/_stats` + + +[[ml-get-inference-stats-prereq]] +==== {api-prereq-title} + +* You must have `monitor_ml` privilege to use this API. For more information, +see <> and <>. + + +[[ml-get-inference-stats-desc]] +==== {api-description-title} + +You can get usage information for multiple trained models in a single API +request by using a comma-separated list of model IDs or a wildcard expression. + + +[[ml-get-inference-stats-path-params]] +==== {api-path-parms-title} + +``:: +(Optional, string) +include::{docdir}/ml/ml-shared.asciidoc[tag=model-id] + + +[[ml-get-inference-stats-query-params]] +==== {api-query-parms-title} + +`allow_no_match`:: +(Optional, boolean) +include::{docdir}/ml/ml-shared.asciidoc[tag=allow-no-match] + +`from`:: +(Optional, integer) +include::{docdir}/ml/ml-shared.asciidoc[tag=from] + +`size`:: +(Optional, integer) +include::{docdir}/ml/ml-shared.asciidoc[tag=size] + + +[[ml-get-inference-stats-response-codes]] +==== {api-response-codes-title} + +`404` (Missing resources):: + If `allow_no_match` is `false`, this code indicates that there are no + resources that match the request or only partial matches for the request. + + +[[ml-get-inference-stats-example]] +==== {api-examples-title} + +The following example gets usage information for all the trained models: + +[source,console] +-------------------------------------------------- +GET _ml/inference/_stats +-------------------------------------------------- +// TEST[skip:TBD] + + +The API returns the following results: + +[source,console-result] +---- +{ + "count": 2, + "trained_model_stats": [ + { + "model_id": "flight-delay-prediction-1574775339910", + "pipeline_count": 0 + }, + { + "model_id": "regression-job-one-1574775307356", + "pipeline_count": 1, + "ingest": { + "total": { + "count": 178, + "time_in_millis": 8, + "current": 0, + "failed": 0 + }, + "pipelines": { + "flight-delay": { + "count": 178, + "time_in_millis": 8, + "current": 0, + "failed": 0, + "processors": [ + { + "inference": { + "type": "inference", + "stats": { + "count": 178, + "time_in_millis": 7, + "current": 0, + "failed": 0 + } + } + } + ] + } + } + } + } + ] +} +---- +// NOTCONSOLE \ No newline at end of file diff --git a/docs/reference/ml/df-analytics/apis/get-inference-trained-model.asciidoc b/docs/reference/ml/df-analytics/apis/get-inference-trained-model.asciidoc new file mode 100644 index 0000000000000..8586962c835cc --- /dev/null +++ b/docs/reference/ml/df-analytics/apis/get-inference-trained-model.asciidoc @@ -0,0 +1,96 @@ +[role="xpack"] +[testenv="basic"] +[[get-inference]] +=== Get {infer} trained model API +[subs="attributes"] +++++ +Get {infer} trained model +++++ + +Retrieves configuration information for a trained {infer} model. + +experimental[] + + +[[ml-get-inference-request]] +==== {api-request-title} + +`GET _ml/inference/` + + +`GET _ml/inference/` + + +`GET _ml/inference/_all` + + +`GET _ml/inference/,` + + +`GET _ml/inference/` + + +[[ml-get-inference-prereq]] +==== {api-prereq-title} + +* You must have `monitor_ml` privilege to use this API. For more information, +see <> and <>. + + +[[ml-get-inference-desc]] +==== {api-description-title} + +You can get information for multiple trained models in a single API request by +using a comma-separated list of model IDs or a wildcard expression. + + +[[ml-get-inference-path-params]] +==== {api-path-parms-title} + +``:: +(Optional, string) +include::{docdir}/ml/ml-shared.asciidoc[tag=model-id] + + +[[ml-get-inference-query-params]] +==== {api-query-parms-title} + +`allow_no_match`:: +(Optional, boolean) +include::{docdir}/ml/ml-shared.asciidoc[tag=allow-no-match] + +`decompress_definition`:: +(Optional, boolean) +include::{docdir}/ml/ml-shared.asciidoc[tag=decompress-definition] + +`from`:: +(Optional, integer) +include::{docdir}/ml/ml-shared.asciidoc[tag=from] + +`include_model_definition`:: +(Optional, boolean) +include::{docdir}/ml/ml-shared.asciidoc[tag=include-model-definition] + +`size`:: +(Optional, integer) +include::{docdir}/ml/ml-shared.asciidoc[tag=size] + + +[[ml-get-inference-response-codes]] +==== {api-response-codes-title} + +`400`:: + If `include_model_definition` is `true`, this code indicates that more than + one models match the ID pattern. + +`404` (Missing resources):: + If `allow_no_match` is `false`, this code indicates that there are no + resources that match the request or only partial matches for the request. + + +[[ml-get-inference-example]] +==== {api-examples-title} + +The following example gets configuration information for all the trained models: + +[source,console] +-------------------------------------------------- +GET _ml/inference/ +-------------------------------------------------- +// TEST[skip:TBD] \ No newline at end of file diff --git a/docs/reference/ml/df-analytics/apis/index.asciidoc b/docs/reference/ml/df-analytics/apis/index.asciidoc index bebd6d3aae820..cdad89f9bb4cd 100644 --- a/docs/reference/ml/df-analytics/apis/index.asciidoc +++ b/docs/reference/ml/df-analytics/apis/index.asciidoc @@ -16,12 +16,21 @@ You can use the following APIs to perform {ml} {dfanalytics} activities. For the `analysis` object resources, check <>. + +You can use the following APIs to perform {infer} operations. + +* <> +* <> +* <> + + See also <>. //CREATE include::put-dfanalytics.asciidoc[] //DELETE include::delete-dfanalytics.asciidoc[] +include::delete-inference-trained-model.asciidoc[] //EVALUATE include::evaluate-dfanalytics.asciidoc[] //ESTIMATE_MEMORY_USAGE @@ -29,6 +38,8 @@ include::explain-dfanalytics.asciidoc[] //GET include::get-dfanalytics.asciidoc[] include::get-dfanalytics-stats.asciidoc[] +include::get-inference-trained-model.asciidoc[] +include::get-inference-trained-model-stats.asciidoc[] //SET/START/STOP include::start-dfanalytics.asciidoc[] include::stop-dfanalytics.asciidoc[] diff --git a/docs/reference/ml/ml-shared.asciidoc b/docs/reference/ml/ml-shared.asciidoc index c13b4e903b91e..c7191896e323f 100644 --- a/docs/reference/ml/ml-shared.asciidoc +++ b/docs/reference/ml/ml-shared.asciidoc @@ -483,6 +483,11 @@ Identifier for the {dfeed}. It can be a {dfeed} identifier or a wildcard expression. end::datafeed-id-wildcard[] +tag::decompress-definition[] +Specifies whether the included model definition should be returned as a JSON map (`true`) or +in a custom compressed format (`false`). Defaults to `true`. +end::decompress-definition[] + tag::delayed-data-check-config[] Specifies whether the {dfeed} checks for missing data and the size of the window. For example: `{"enabled": true, "check_window": "1h"}`. @@ -688,6 +693,12 @@ tag::groups[] A list of job groups. A job can belong to no groups or many. end::groups[] +tag::include-model-definition[] +Specifies if the model definition should be returned in the response. Defaults +to `false`. When `true`, only a single model must match the ID patterns +provided, otherwise a bad request is returned. +end::include-model-definition[] + tag::indices[] An array of index names. Wildcards are supported. For example: `["it_ops_metrics", "server*"]`. @@ -828,6 +839,10 @@ recommended value. -- end::mode[] +tag::model-id[] +The unique identifier of the trained {infer} model. +end::model-id[] + tag::model-memory-limit[] The approximate maximum amount of memory resources that are required for analytical processing. Once this limit is approached, data pruning becomes