Sync machine learning saved objects API

edit

Sync machine learning saved objects API

edit

Synchronizes Kibana saved objects for machine learning jobs.

Request

edit

GET <kibana host>:<port>/api/ml/saved_objects/sync

GET <kibana host>:<port>/s/<space_id>/api/ml/saved_objects/sync

Path parameters

edit
space_id
(Optional, string) An identifier for the space. If space_id is not provided in the URL the default space is used.

Query parameters

edit
simulate
(Optional, boolean) When true, simulates the synchronization by only returning the list actions that would be performed.

Response body

edit
datafeedsAdded
(array) If a saved object for an anomaly detection job is missing a datafeed identifier, it is added. This list contains the datafeed identifiers and indicates whether the synchronization was successful.
datafeedsRemoved
(array) If saved objects exist for datafeeds that no longer exist, they are deleted. This list contains the datafeed identifiers and indicates whether the synchronization was successful.
savedObjectsCreated
(array) If saved objects are missing for machine learning jobs, they are created. This list contains the job identifiers and indicates whether the synchronization was successful.
savedObjectsDeleted
(array) If saved objects exist for jobs that no longer exist, they are deleted. This list contains the job identifiers and indicates whether the synchronization was successful.

Response code

edit
200
Indicates a successful call.

Example

edit

Retrieve the list of machine learning saved objects that require synchronization:

$ curl -X GET api/ml/saved_objects/sync?simulate=true

If there are two jobs and a datafeed that need to be synchronized, for example, the API returns the following:

{{"savedObjectsCreated":{"myjob1":{"success":true},"myjob2":{"success":true}},"savedObjectsDeleted":{},"datafeedsAdded":{},"datafeedsRemoved":{"myfeed3":{"success":true}}}

To perform the synchronization, re-run the API and omit the simulate parameter.