Sharing saved objects developer guide#107099
Conversation
69a8983 to
2e3e41c
Compare
The server-side implementation returned a `saved_object` field, while the client-side implementation returned a `savedObject` field. I originally used the former to align with return types like that from `bulkGet()`, `bulkUpdate()`, etc., but I think it makes more sense to use snakeCase on both client- and server-side for simplicity.
9beee0f to
925bfbb
Compare
925bfbb to
53cbb83
Compare
Script for generating
|
|
ACK: reviewing... |
azasypkin
left a comment
There was a problem hiding this comment.
Awesome job, learned a lot! 🙂 LGTM
|
@elastic/kibana-docs I contemplated linking to this page from Breaking changes in 8.0, but these aren't breaking changes that affect end-users. So I don't think it's really appropriate to include there. WDYT? |
KOTungseth
left a comment
There was a problem hiding this comment.
The .asciidoc changes LGTM, but for the developer docs, @stacey-gammon might want to take a look.
This reverts commit 013de84.
* Add Sharing Saved Objects section in new dev docs; this intentionally links to the legacy docs page (which is intended to be viewed by both internal and external developers) * Remove docs examples of `namespaceType: 'single'` since we want folks to stop using that.
|
@elasticmachine merge upstream |
|
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]Page load bundle
History
To update your PR or re-run it, just comment with: |
# Conflicts: # docs/developer/advanced/index.asciidoc
|
Hey @jportner I tried to re-test the behavior for Lens SO, but something is not working right, unless I am forgetting something? Following the steps from above on any Lens SO (retried on Graph, same), I get the generated staging data and a response about updates executed correctly. Am I missing something or something got broken? Staging data``` POST .kibana/_bulk {"index":{"_id":"index-pattern:d3d7af60-4c81-11e8-b3d7-01146121b73d"}} {"index-pattern":{"fieldFormatMap":"{\"hour_of_day\":{\"id\":\"number\",\"params\":{\"pattern\":\"00\"}},\"AvgTicketPrice\":{\"id\":\"number\",\"params\":{\"pattern\":\"$0,0.[00]\"}}}","runtimeFieldMap":"{\"hour_of_day\":{\"type\":\"long\",\"script\":{\"source\":\"emit(doc['timestamp'].value.getHour());\"}}}","timeFieldName":"timestamp","title":"kibana_sample_data_flights"},"coreMigrationVersion":"8.0.0","migrationVersion":{"index-pattern":"7.11.0"},"references":[],"type":"index-pattern","updated_at":"2021-09-21T10:55:48.482Z"} {"index":{"_id":"test1:lens:725a2be0-1ace-11ec-acee-9f628a4e2e5b-test1"}} {"lens":{"description":"","state":{"datasourceStates":{"indexpattern":{"layers":{"dde73e35-b62d-4900-9f81-072dcd82f2e8":{"columnOrder":["628dfb9c-50dd-4c07-80e3-a00b2a526b88","cf81f58a-ebb1-43f9-a202-9cfe5ad07bd6"],"columns":{"628dfb9c-50dd-4c07-80e3-a00b2a526b88":{"dataType":"date","isBucketed":true,"label":"timestamp","operationType":"date_histogram","params":{"interval":"auto"},"scale":"interval","sourceField":"timestamp"},"cf81f58a-ebb1-43f9-a202-9cfe5ad07bd6":{"dataType":"number","isBucketed":false,"label":"Count of records","operationType":"count","scale":"ratio","sourceField":"Records"}},"incompleteColumns":{}}}}},"filters":[],"query":{"language":"kuery","query":""},"visualization":{"axisTitlesVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"fittingFunction":"None","gridlinesVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"labelsOrientation":{"x":0,"yLeft":0,"yRight":0},"layers":[{"accessors":["cf81f58a-ebb1-43f9-a202-9cfe5ad07bd6"],"layerId":"dde73e35-b62d-4900-9f81-072dcd82f2e8","layerType":"data","position":"top","seriesType":"bar_stacked","showGridlines":false,"xAccessor":"628dfb9c-50dd-4c07-80e3-a00b2a526b88"}],"legend":{"isVisible":true,"position":"right"},"preferredSeriesType":"bar_stacked","tickLabelsVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"valueLabels":"hide","yLeftExtent":{"mode":"full"},"yRightExtent":{"mode":"full"}}},"title":"Lens","visualizationType":"lnsXY"},"coreMigrationVersion":"8.0.0","migrationVersion":{"lens":"8.0.0"},"references":[{"id":"d3d7af60-4c81-11e8-b3d7-01146121b73d-test1","name":"indexpattern-datasource-current-indexpattern","type":"index-pattern"},{"id":"d3d7af60-4c81-11e8-b3d7-01146121b73d-test1","name":"indexpattern-datasource-layer-dde73e35-b62d-4900-9f81-072dcd82f2e8","type":"index-pattern"}],"type":"lens","updated_at":"2021-09-21T11:24:12.577Z","namespace":"test1"} {"index":{"_id":"test2:lens:725a2be0-1ace-11ec-acee-9f628a4e2e5b-test2-newId"}} {"lens":{"description":"","state":{"datasourceStates":{"indexpattern":{"layers":{"dde73e35-b62d-4900-9f81-072dcd82f2e8":{"columnOrder":["628dfb9c-50dd-4c07-80e3-a00b2a526b88","cf81f58a-ebb1-43f9-a202-9cfe5ad07bd6"],"columns":{"628dfb9c-50dd-4c07-80e3-a00b2a526b88":{"dataType":"date","isBucketed":true,"label":"timestamp","operationType":"date_histogram","params":{"interval":"auto"},"scale":"interval","sourceField":"timestamp"},"cf81f58a-ebb1-43f9-a202-9cfe5ad07bd6":{"dataType":"number","isBucketed":false,"label":"Count of records","operationType":"count","scale":"ratio","sourceField":"Records"}},"incompleteColumns":{}}}}},"filters":[],"query":{"language":"kuery","query":""},"visualization":{"axisTitlesVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"fittingFunction":"None","gridlinesVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"labelsOrientation":{"x":0,"yLeft":0,"yRight":0},"layers":[{"accessors":["cf81f58a-ebb1-43f9-a202-9cfe5ad07bd6"],"layerId":"dde73e35-b62d-4900-9f81-072dcd82f2e8","layerType":"data","position":"top","seriesType":"bar_stacked","showGridlines":false,"xAccessor":"628dfb9c-50dd-4c07-80e3-a00b2a526b88"}],"legend":{"isVisible":true,"position":"right"},"preferredSeriesType":"bar_stacked","tickLabelsVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"valueLabels":"hide","yLeftExtent":{"mode":"full"},"yRightExtent":{"mode":"full"}}},"title":"Lens","visualizationType":"lnsXY"},"coreMigrationVersion":"8.0.0","migrationVersion":{"lens":"8.0.0"},"references":[{"id":"d3d7af60-4c81-11e8-b3d7-01146121b73d-test2-newId","name":"indexpattern-datasource-current-indexpattern","type":"index-pattern"},{"id":"d3d7af60-4c81-11e8-b3d7-01146121b73d-test2-newId","name":"indexpattern-datasource-layer-dde73e35-b62d-4900-9f81-072dcd82f2e8","type":"index-pattern"}],"type":"lens","updated_at":"2021-09-21T11:24:12.577Z","namespace":"test2"} {"index":{"_id":"test3:lens:725a2be0-1ace-11ec-acee-9f628a4e2e5b-test3"}} {"lens":{"description":"","state":{"datasourceStates":{"indexpattern":{"layers":{"dde73e35-b62d-4900-9f81-072dcd82f2e8":{"columnOrder":["628dfb9c-50dd-4c07-80e3-a00b2a526b88","cf81f58a-ebb1-43f9-a202-9cfe5ad07bd6"],"columns":{"628dfb9c-50dd-4c07-80e3-a00b2a526b88":{"dataType":"date","isBucketed":true,"label":"timestamp","operationType":"date_histogram","params":{"interval":"auto"},"scale":"interval","sourceField":"timestamp"},"cf81f58a-ebb1-43f9-a202-9cfe5ad07bd6":{"dataType":"number","isBucketed":false,"label":"Count of records","operationType":"count","scale":"ratio","sourceField":"Records"}},"incompleteColumns":{}}}}},"filters":[],"query":{"language":"kuery","query":""},"visualization":{"axisTitlesVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"fittingFunction":"None","gridlinesVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"labelsOrientation":{"x":0,"yLeft":0,"yRight":0},"layers":[{"accessors":["cf81f58a-ebb1-43f9-a202-9cfe5ad07bd6"],"layerId":"dde73e35-b62d-4900-9f81-072dcd82f2e8","layerType":"data","position":"top","seriesType":"bar_stacked","showGridlines":false,"xAccessor":"628dfb9c-50dd-4c07-80e3-a00b2a526b88"}],"legend":{"isVisible":true,"position":"right"},"preferredSeriesType":"bar_stacked","tickLabelsVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"valueLabels":"hide","yLeftExtent":{"mode":"full"},"yRightExtent":{"mode":"full"}}},"title":"Lens","visualizationType":"lnsXY"},"coreMigrationVersion":"8.0.0","migrationVersion":{"lens":"8.0.0"},"references":[{"id":"d3d7af60-4c81-11e8-b3d7-01146121b73d-test3","name":"indexpattern-datasource-current-indexpattern","type":"index-pattern"},{"id":"d3d7af60-4c81-11e8-b3d7-01146121b73d-test3","name":"indexpattern-datasource-layer-dde73e35-b62d-4900-9f81-072dcd82f2e8","type":"index-pattern"}],"type":"lens","updated_at":"2021-09-21T11:24:12.577Z","namespace":"test3"} {"index":{"_id":"test3:lens:725a2be0-1ace-11ec-acee-9f628a4e2e5b-test3-newId"}} {"lens":{"description":"","state":{"datasourceStates":{"indexpattern":{"layers":{"dde73e35-b62d-4900-9f81-072dcd82f2e8":{"columnOrder":["628dfb9c-50dd-4c07-80e3-a00b2a526b88","cf81f58a-ebb1-43f9-a202-9cfe5ad07bd6"],"columns":{"628dfb9c-50dd-4c07-80e3-a00b2a526b88":{"dataType":"date","isBucketed":true,"label":"timestamp","operationType":"date_histogram","params":{"interval":"auto"},"scale":"interval","sourceField":"timestamp"},"cf81f58a-ebb1-43f9-a202-9cfe5ad07bd6":{"dataType":"number","isBucketed":false,"label":"Count of records","operationType":"count","scale":"ratio","sourceField":"Records"}},"incompleteColumns":{}}}}},"filters":[],"query":{"language":"kuery","query":""},"visualization":{"axisTitlesVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"fittingFunction":"None","gridlinesVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"labelsOrientation":{"x":0,"yLeft":0,"yRight":0},"layers":[{"accessors":["cf81f58a-ebb1-43f9-a202-9cfe5ad07bd6"],"layerId":"dde73e35-b62d-4900-9f81-072dcd82f2e8","layerType":"data","position":"top","seriesType":"bar_stacked","showGridlines":false,"xAccessor":"628dfb9c-50dd-4c07-80e3-a00b2a526b88"}],"legend":{"isVisible":true,"position":"right"},"preferredSeriesType":"bar_stacked","tickLabelsVisibilitySettings":{"x":true,"yLeft":true,"yRight":true},"valueLabels":"hide","yLeftExtent":{"mode":"full"},"yRightExtent":{"mode":"full"}}},"title":"Lens","visualizationType":"lnsXY"},"coreMigrationVersion":"8.0.0","migrationVersion":{"lens":"8.0.0"},"references":[{"id":"d3d7af60-4c81-11e8-b3d7-01146121b73d-test3-newId","name":"indexpattern-datasource-current-indexpattern","type":"index-pattern"},{"id":"d3d7af60-4c81-11e8-b3d7-01146121b73d-test3-newId","name":"indexpattern-datasource-layer-dde73e35-b62d-4900-9f81-072dcd82f2e8","type":"index-pattern"}],"type":"lens","updated_at":"2021-09-21T11:24:12.577Z","namespace":"test3"} {"index":{"_id":"legacy-url-alias:test2:lens:725a2be0-1ace-11ec-acee-9f628a4e2e5b-test2"}} {"legacy-url-alias":{"targetNamespace":"test2","targetType":"lens","targetId":"725a2be0-1ace-11ec-acee-9f628a4e2e5b-test2-newId","sourceId":"725a2be0-1ace-11ec-acee-9f628a4e2e5b-test2"},"type":"legacy-url-alias","references":[]} {"index":{"_id":"legacy-url-alias:test3:lens:725a2be0-1ace-11ec-acee-9f628a4e2e5b-test3"}} {"legacy-url-alias":{"targetNamespace":"test3","targetType":"lens","targetId":"725a2be0-1ace-11ec-acee-9f628a4e2e5b-test3-newId","sourceId":"725a2be0-1ace-11ec-acee-9f628a4e2e5b-test3"},"type":"legacy-url-alias","references":[]} {"index":{"_id":"space:test1"}} {"space":{"name":"Test 1: Resolve Exact Match","initials":"T1","description":"In this space, test object(s) will resolve with an \"exactMatch\" outcome.","disabledFeatures":[]},"type":"space"} {"index":{"_id":"space:test2"}} {"space":{"name":"Test 2: Resolve Alias Match","initials":"T2","description":"In this space, test object(s) will resolve with an \"aliasMatch\" outcome.","disabledFeatures":[]},"type":"space"} {"index":{"_id":"space:test3"}} {"space":{"name":"Test 3: Resolve Conflict","initials":"T3","description":"In this space, test object(s) will resolve with a \"conflict\" outcome.","disabledFeatures":[]},"type":"space"} ```And the response: Response |
What version of the script did you use? The current version (attached in the comment above) is v1.3. Click to expandThat gives me this staging data: Click to expandThis staging data is different than what you posted above (it has an index pattern for each space). That said, now that we have the correct staging data, I think I found a different problem. Edit: I identified two problems, one with "aliasMatch" outcomes and another one with "conflict" outcomes. They are tracked on this issue: #113160 Edit 2: that issue has been fixed now (sep 29). |
Resolves #88744 to add a developer guide for Sharing Saved Objects.
Also slightly changes the SavedObjectsClient
resolve()return type on the server side, so it matches the public one (013de84).
Docs preview link