Skip to content

Commit 378bc76

Browse files
authored
Sharing saved objects developer guide (#107099) (#108132)
# Conflicts: # docs/developer/advanced/index.asciidoc
1 parent 331a27c commit 378bc76

File tree

35 files changed

+545
-42
lines changed

35 files changed

+545
-42
lines changed

dev_docs/key_concepts/saved_objects.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,17 @@ Sometimes Saved Objects end up persisted inside another Saved Object. We call th
7272
issues with edits propagating - since an entity can only exist in a single place.
7373
Note that from the end user stand point, we don’t use these terms “by reference” and “by value”.
7474

75+
## Sharing Saved Objects
76+
77+
Starting in Kibana 7.12, saved objects can be shared to multiple spaces. The "space behavior" is determined for each object type depending
78+
on how it is registered.
79+
80+
If you are adding a **new** object type, when you register it:
81+
82+
1. Use `namespaceType: 'multiple-isolated'` to make these objects exist in exactly one space
83+
2. Use `namespaceType: 'multiple'` to make these objects exist in one *or more* spaces
84+
3. Use `namespaceType: 'agnostic'` if you want these objects to always exist in all spaces
85+
86+
If you have an **existing** "legacy" object type that is not shareable (using `namespaceType: 'single'`), see the [legacy developer guide
87+
for Sharing Saved Objects](https://www.elastic.co/guide/en/kibana/master/sharing-saved-objects.html) for details on steps you need to take
88+
to make sure this is converted to `namespaceType: 'multiple-isolated'` or `namespaceType: 'multiple'` in the 8.0 release.

dev_docs/tutorials/saved_objects.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { SavedObjectsType } from 'src/core/server';
1919
export const dashboardVisualization: SavedObjectsType = {
2020
name: 'dashboard_visualization', [1]
2121
hidden: false,
22-
namespaceType: 'single',
22+
namespaceType: 'multiple-isolated', [2]
2323
mappings: {
2424
dynamic: false,
2525
properties: {
@@ -41,6 +41,10 @@ export const dashboardVisualization: SavedObjectsType = {
4141
[1] Since the name of a Saved Object type forms part of the url path for the public Saved Objects HTTP API,
4242
these should follow our API URL path convention and always be written as snake case.
4343

44+
[2] This field determines "space behavior" -- whether these objects can exist in one space, multiple spaces, or all spaces. This value means
45+
that objects of this type can only exist in a single space. See
46+
<DocLink id="kibDevDocsSavedObjectsIntro" section="sharing-saved-objects" text="Sharing Saved Objects"/> for more information.
47+
4448
**src/plugins/my_plugin/server/saved_objects/index.ts**
4549

4650
```ts

docs/api/saved-objects/resolve.asciidoc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ The `outcome` field may be any of the following:
7070
* `"aliasMatch"` -- One document with a legacy URL alias matched the given ID; in this case the `saved_object.id` field is different than the given ID.
7171
* `"conflict"` -- Two documents matched the given ID, one was an exact match and another with a legacy URL alias; in this case the `saved_object` object is the exact match, and the `saved_object.id` field is the same as the given ID.
7272

73+
If the outcome is `"aliasMatch"` or `"conflict"`, the response will also include an `alias_target_id` field. This means that an alias was found for another object, and it describes that other object's ID.
74+
7375
Retrieve a dashboard object in the `testspace` by ID:
7476

7577
[source,sh]
@@ -125,6 +127,7 @@ The API returns the following:
125127
"dashboard": "7.0.0"
126128
}
127129
},
128-
"outcome": "conflict"
130+
"outcome": "conflict",
131+
"alias_target_id": "05becb88-e214-439a-a2ac-15fc783b5d01"
129132
}
130133
--------------------------------------------------
172 KB
Loading
90.7 KB
Loading
134 KB
Loading
38.1 KB
Loading
42.8 KB
Loading
51.2 KB
Loading
66.2 KB
Loading

0 commit comments

Comments
 (0)