Sync machine learning saved objects APIedit
Synchronizes Kibana saved objects for machine learning jobs and trained models.
For the most up-to-date API details, refer to the open API specification. For a preview, check out Machine learning APIs.
Requestedit
GET <kibana host>:<port>/api/ml/saved_objects/sync
GET <kibana host>:<port>/s/<space_id>/api/ml/saved_objects/sync
Prerequisitesedit
You must have all
privileges for the Machine Learning feature in the Analytics section of the
Kibana feature privileges.
Descriptionedit
This API runs automatically when you start Kibana and periodically thereafter.
Path parametersedit
-
space_id
-
(Optional, string) An identifier for the space. If
space_id
is not provided in the URL the default space is used.
Query parametersedit
-
simulate
-
(Optional, boolean) When
true
, simulates the synchronization by only returning the list actions that would be performed.
Response bodyedit
-
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 a saved object for an anomaly detection job references a datafeed that no longer exists, it is 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 codesedit
-
200
- Indicates a successful call.
Examplesedit
Retrieve the list of machine learning saved objects that require synchronization:
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.