Swap references data view API

edit

Swap references data view API

edit

Swap saved object references

Misuse can break large numbers of saved objects! Practicing with a backup is recommended.

For the most up-to-date API details, refer to the open API specification.

Request

edit

POST <kibana host>:<port>/api/data_views/swap_references

POST <kibana host>:<port>/s/<space_id>/api/data_views/swap_references

Request body

edit
fromId
(Required, string) Saved object reference to change.
toId
(Required, string) New saved object reference value to replace the old.
delete
(Optional, boolean) Deletes referenced saved object if all references are removed.
fromType
(Optional, string) Specify the type of the saved object reference to alter. Default is index-pattern for data view.
forId
(Optional, string or string[]) Limit the affected saved objects to one or more by IDs.
forType
(Optional, string) Limit the affected saved objects by type.

Response code

edit
200
Indicates a successful call.

Examples

edit

Swap references to data view id "abcd-efg" with "xyz-123":

$ curl -X api/data_views/swap_references
{
     "fromId" : "abcd-efg",
     "toId" : "xyz-123",
     "delete" : true // optional, removes data view which is no longer referenced
}

The API returns a list of affected saved objects:

{
  result: [{ id: "123", type: "visualization" }],
  deleteStatus: {
    remainingRefs: 0,
    deletePerformed: true
  }
}