OpenSearch/docs/en/rest-api/ml/update-datafeed.asciidoc

132 lines
2.6 KiB
Plaintext

[[ml-update-datafeed]]
==== Update Data Feeds
The update data feed API allows you to update certain properties of a data feed.
===== Request
`POST _xpack/ml/datafeeds/<feed_id>/_update`
////
===== Description
TBD
////
===== Path Parameters
`feed_id` (required)::
(+string+) Identifier for the data feed
===== Request Body
The following properties can be updated after the data feed is created:
aggregations::
(+object+) TBD.
frequency::
TBD: For example: "150s"
indexes (required)::
(+array+) An array of index names. For example: ["it_ops_metrics"]
job_id::
(+string+) A numerical character string that uniquely identifies the job.
query::
(+object+) The query that retrieves the data.
By default, this property has the following value: `{"match_all": {"boost": 1}}`.
query_delay::
TBD. For example: "60s"
scroll_size::
TBD. For example, 1000
types (required)::
TBD. For example: ["network","sql","kpi"]
For more information about these properties,
see <<ml-datafeed-resource, Data Feed Resources>>.
////
===== Responses
TBD
200
(EmptyResponse) The cluster has been successfully deleted
404
(BasicFailedReply) The cluster specified by {cluster_id} cannot be found (code: clusters.cluster_not_found)
412
(BasicFailedReply) The Elasticsearch cluster has not been shutdown yet (code: clusters.cluster_plan_state_error)
////
===== Examples
The following example updates the `it-ops-kpi` job:
[source,js]
--------------------------------------------------
POST _xpack/ml/datafeeds/datafeed-it-ops-kpi3/_update
{
"aggregations": {
"@timestamp": {
"histogram": {
"field": "@timestamp",
"interval": 30000,
"offset": 0,
"order": {
"_key": "asc"
},
"keyed": false,
"min_doc_count": 0
},
"aggregations": {
"events_per_min": {
"sum": {
"field": "events_per_min"
}
}
}
}
},
"frequency": "160s"
}
--------------------------------------------------
// CONSOLE
// TEST[skip:todo]
When the data feed is updated, you receive the following results:
----
{
"datafeed_id": "datafeed-it-ops-kpi",
"job_id": "it-ops-kpi",
"query_delay": "1m",
"frequency": "160s",
...
"aggregations": {
"@timestamp": {
"histogram": {
"field": "@timestamp",
"interval": 30000,
"offset": 0,
"order": {
"_key": "asc"
},
"keyed": false,
"min_doc_count": 0
},
"aggregations": {
"events_per_min": {
"sum": {
"field": "events_per_min"
}
}
}
}
},
"scroll_size": 1000
}
----