mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 10:25:15 +00:00
[DOCS] Adds GET, GET stats and DELETE inference APIs (#50224)
Co-Authored-By: Lisa Cawley <lcawley@elastic.co>
This commit is contained in:
parent
ac974c35c0
commit
5759a263cb
@ -0,0 +1,67 @@
|
||||
[role="xpack"]
|
||||
[testenv="basic"]
|
||||
[[delete-inference]]
|
||||
=== Delete {infer} trained model API
|
||||
[subs="attributes"]
|
||||
++++
|
||||
<titleabbrev>Delete {infer} trained model</titleabbrev>
|
||||
++++
|
||||
|
||||
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/<model_id>`
|
||||
|
||||
|
||||
[[ml-delete-inference-prereq]]
|
||||
==== {api-prereq-title}
|
||||
|
||||
* You must have `machine_learning_admin` built-in role to use this API. For more
|
||||
information, see <<security-privileges>> and <<built-in-roles>>.
|
||||
|
||||
|
||||
[[ml-delete-inference-path-params]]
|
||||
==== {api-path-parms-title}
|
||||
|
||||
`<model_id>`::
|
||||
(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
|
||||
}
|
||||
----
|
||||
|
||||
|
@ -0,0 +1,134 @@
|
||||
[role="xpack"]
|
||||
[testenv="basic"]
|
||||
[[get-inference-stats]]
|
||||
=== Get {infer} trained model statistics API
|
||||
[subs="attributes"]
|
||||
++++
|
||||
<titleabbrev>Get {infer} trained model stats</titleabbrev>
|
||||
++++
|
||||
|
||||
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/<model_id>/_stats` +
|
||||
|
||||
`GET _ml/inference/<model_id>,<model_id_2>/_stats` +
|
||||
|
||||
`GET _ml/inference/<model_id_pattern*>,<model_id_2>/_stats`
|
||||
|
||||
|
||||
[[ml-get-inference-stats-prereq]]
|
||||
==== {api-prereq-title}
|
||||
|
||||
* You must have `monitor_ml` privilege to use this API. For more information,
|
||||
see <<security-privileges>> and <<built-in-roles>>.
|
||||
|
||||
|
||||
[[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}
|
||||
|
||||
`<model_id>`::
|
||||
(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
|
@ -0,0 +1,96 @@
|
||||
[role="xpack"]
|
||||
[testenv="basic"]
|
||||
[[get-inference]]
|
||||
=== Get {infer} trained model API
|
||||
[subs="attributes"]
|
||||
++++
|
||||
<titleabbrev>Get {infer} trained model</titleabbrev>
|
||||
++++
|
||||
|
||||
Retrieves configuration information for a trained {infer} model.
|
||||
|
||||
experimental[]
|
||||
|
||||
|
||||
[[ml-get-inference-request]]
|
||||
==== {api-request-title}
|
||||
|
||||
`GET _ml/inference/` +
|
||||
|
||||
`GET _ml/inference/<model_id>` +
|
||||
|
||||
`GET _ml/inference/_all` +
|
||||
|
||||
`GET _ml/inference/<model_id1>,<model_id2>` +
|
||||
|
||||
`GET _ml/inference/<model_id_pattern*>`
|
||||
|
||||
|
||||
[[ml-get-inference-prereq]]
|
||||
==== {api-prereq-title}
|
||||
|
||||
* You must have `monitor_ml` privilege to use this API. For more information,
|
||||
see <<security-privileges>> and <<built-in-roles>>.
|
||||
|
||||
|
||||
[[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}
|
||||
|
||||
`<model_id>`::
|
||||
(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]
|
@ -16,12 +16,21 @@ You can use the following APIs to perform {ml} {dfanalytics} activities.
|
||||
|
||||
For the `analysis` object resources, check <<ml-dfa-analysis-objects>>.
|
||||
|
||||
|
||||
You can use the following APIs to perform {infer} operations.
|
||||
|
||||
* <<get-inference>>
|
||||
* <<get-inference-stats>>
|
||||
* <<delete-inference>>
|
||||
|
||||
|
||||
See also <<ml-apis>>.
|
||||
|
||||
//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[]
|
||||
|
@ -431,6 +431,52 @@ sorted by the `id` value in ascending order.
|
||||
percentage.
|
||||
end::data-frame-analytics-stats[]
|
||||
|
||||
tag::datafeed-id[]
|
||||
A numerical character string that uniquely identifies the
|
||||
{dfeed}. This identifier can contain lowercase alphanumeric characters (a-z
|
||||
and 0-9), hyphens, and underscores. It must start and end with alphanumeric
|
||||
characters.
|
||||
end::datafeed-id[]
|
||||
|
||||
tag::datafeed-id-wildcard[]
|
||||
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"}`.
|
||||
+
|
||||
--
|
||||
The {dfeed} can optionally search over indices that have already been read in
|
||||
an effort to determine whether any data has subsequently been added to the index.
|
||||
If missing data is found, it is a good indication that the `query_delay` option
|
||||
is set too low and the data is being indexed after the {dfeed} has passed that
|
||||
moment in time. See
|
||||
{stack-ov}/ml-delayed-data-detection.html[Working with delayed data].
|
||||
|
||||
This check runs only on real-time {dfeeds}.
|
||||
|
||||
The configuration object has the following properties:
|
||||
|
||||
`enabled`::
|
||||
(boolean) Specifies whether the {dfeed} periodically checks for delayed data.
|
||||
Defaults to `true`.
|
||||
|
||||
`check_window`::
|
||||
(<<time-units,time units>>) The window of time that is searched for late data.
|
||||
This window of time ends with the latest finalized bucket. It defaults to
|
||||
`null`, which causes an appropriate `check_window` to be calculated when the
|
||||
real-time {dfeed} runs. In particular, the default `check_window` span
|
||||
calculation is based on the maximum of `2h` or `8 * bucket_span`.
|
||||
--
|
||||
end::delayed-data-check-config[]
|
||||
|
||||
tag::dependent-variable[]
|
||||
Defines which field of the document is to be predicted.
|
||||
This parameter is supplied by field name and must match one of the fields in
|
||||
@ -600,6 +646,23 @@ 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*"]`.
|
||||
+
|
||||
--
|
||||
NOTE: If any indices are in remote clusters then `cluster.remote.connect` must
|
||||
not be set to `false` on any {ml} nodes.
|
||||
|
||||
--
|
||||
end::indices[]
|
||||
|
||||
tag::influencers[]
|
||||
A comma separated list of influencer field names. Typically these can be the by,
|
||||
over, or partition fields that are used in the detector configuration. You might
|
||||
@ -710,6 +773,21 @@ ensemble method. Available methods are `lof`, `ldof`, `distance_kth_nn`,
|
||||
`distance_knn`.
|
||||
end::method[]
|
||||
|
||||
tag::mode[]
|
||||
There are three available modes:
|
||||
+
|
||||
--
|
||||
* `auto`: The chunk size is dynamically calculated. This is the default and
|
||||
recommended value.
|
||||
* `manual`: Chunking is applied according to the specified `time_span`.
|
||||
* `off`: No chunking is applied.
|
||||
--
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user