Swap references data view APIedit

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.

Requestedit

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

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

Request bodyedit

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 codeedit

200
Indicates a successful call.

Examplesedit

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
  }
}