Sync machine learning saved objects API

edit

Sync machine learning saved objects API

edit

Synchronizes Kibana saved objects for machine learning jobs and trained models.

Request

edit

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

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

Prerequisites

edit

You must have all privileges for the Machine Learning feature in the Analytics section of the Kibana feature privileges.

Description

edit

This API runs automatically when you start Kibana and periodically thereafter.

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 or trained models, they are created. This list contains the job and model identifiers and indicates whether the synchronization was successful.
savedObjectsDeleted
(array) If saved objects exist for machine learning jobs or trained models that no longer exist, they are deleted. This list contains the job and model identifiers and indicates whether the synchronization was successful.

Response codes

edit
200
Indicates a successful call.

Examples

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 that need to be synchronized, for example, the API returns the following response:

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

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