Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sharing saved objects developer guide #107099

Merged

Conversation

jportner
Copy link
Contributor

@jportner jportner commented Jul 28, 2021

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

@jportner jportner added v8.0.0 release_note:skip Skip the PR/issue when compiling release notes v7.15.0 labels Jul 28, 2021
@jportner jportner force-pushed the issue-88744-sharing-saved-objects-guide branch 3 times, most recently from 69a8983 to 2e3e41c Compare July 30, 2021 15:49
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.
@jportner jportner force-pushed the issue-88744-sharing-saved-objects-guide branch 4 times, most recently from 9beee0f to 925bfbb Compare July 30, 2021 17:16
@jportner jportner force-pushed the issue-88744-sharing-saved-objects-guide branch from 925bfbb to 53cbb83 Compare July 30, 2021 17:38
@jportner
Copy link
Contributor Author

jportner commented Aug 2, 2021

Script for generating resolve staging data

Instructions:

  1. Use Kibana to create a saved object of a given type
  2. Use the Saved Objects Management page to export the object (downloads an export.ndjson file)
  3. Use the script above to generate staging data based on that file
  4. Use Kibana Dev Tools to add the staging data
  5. Use curl to verify that the different outcomes occur
  6. Navigate to your app using the given object ID as a deep link to verify that your app handles the different outcomes correctly

Sample usage:

Running the script:

% node generate_resolve_staging_data.js "/Users/joe/Downloads/export.ndjson"    

Note, this script will generate staging data to allow you to exercise the three different SavedObjectsClient.resolve() outcomes. HOWEVER, this is NOT a 100% realistic representation of objects that have been converted to become share-capable. When you implement the actual conversion, you should write integration tests to ensure that objects are migrated as expected.

How is the "visualization" object type CURRENTLY registered?
  [1] namespaceType: 'single' (default)
  [2] namespaceType: 'multiple-isolated'
  [3] namespaceType: 'multiple'
  [4] namespaceType: 'agnostic'
1
--------------------
Wrote staging data to "/Users/joe/Downloads/generate_resolve_staging_data/resolve-staging-data.txt", use Kibana Dev Tools to add it to your instance! Example:
  POST .kibana/_bulk
  {"index":{"_id":"test1:visualization:2e73ed30-fac6-11eb-9948-551479ec02ae-test1"}}
  ...

After loading staging data, test the different outcomes using the following CURL commands:
  curl -sSu elastic:changeme http://localhost:5601/s/test1/api/saved_objects/resolve/visualization/2e73ed30-fac6-11eb-9948-551479ec02ae-test1 | npx -q json
  curl -sSu elastic:changeme http://localhost:5601/s/test2/api/saved_objects/resolve/visualization/2e73ed30-fac6-11eb-9948-551479ec02ae-test2 | npx -q json
  curl -sSu elastic:changeme http://localhost:5601/s/test3/api/saved_objects/resolve/visualization/2e73ed30-fac6-11eb-9948-551479ec02ae-test3 | npx -q json
(note, URLs need to be modified if you are running Kibana with a basePath)
--------------------

Then, adding the staging data in Dev Tools:

POST .kibana/_bulk
{"index":{"_id":"test1:visualization:2e73ed30-fac6-11eb-9948-551479ec02ae-test1"}}
{"visualization":{"description":"","kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}"},"title":"Test viz","uiStateJSON":"{}","version":1,"visState":"{\"title\":\"Test viz\",\"type\":\"markdown\",\"aggs\":[],\"params\":{\"fontSize\":12,\"openLinksInNewTab\":false,\"markdown\":\"Hello, world!\"}}"},"coreMigrationVersion":"8.0.0","migrationVersion":{"visualization":"7.14.0"},"references":[],"type":"visualization","updated_at":"2021-08-11T17:04:25.480Z","namespace":"test1"}
{"index":{"_id":"test2:visualization:2e73ed30-fac6-11eb-9948-551479ec02ae-test2-newId"}}
{"visualization":{"description":"","kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}"},"title":"Test viz","uiStateJSON":"{}","version":1,"visState":"{\"title\":\"Test viz\",\"type\":\"markdown\",\"aggs\":[],\"params\":{\"fontSize\":12,\"openLinksInNewTab\":false,\"markdown\":\"Hello, world!\"}}"},"coreMigrationVersion":"8.0.0","migrationVersion":{"visualization":"7.14.0"},"references":[],"type":"visualization","updated_at":"2021-08-11T17:04:25.480Z","namespace":"test2"}
{"index":{"_id":"test3:visualization:2e73ed30-fac6-11eb-9948-551479ec02ae-test3"}}
{"visualization":{"description":"","kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}"},"title":"Test viz","uiStateJSON":"{}","version":1,"visState":"{\"title\":\"Test viz\",\"type\":\"markdown\",\"aggs\":[],\"params\":{\"fontSize\":12,\"openLinksInNewTab\":false,\"markdown\":\"Hello, world!\"}}"},"coreMigrationVersion":"8.0.0","migrationVersion":{"visualization":"7.14.0"},"references":[],"type":"visualization","updated_at":"2021-08-11T17:04:25.480Z","namespace":"test3"}
{"index":{"_id":"test3:visualization:2e73ed30-fac6-11eb-9948-551479ec02ae-test3-newId"}}
{"visualization":{"description":"","kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}"},"title":"Test viz","uiStateJSON":"{}","version":1,"visState":"{\"title\":\"Test viz\",\"type\":\"markdown\",\"aggs\":[],\"params\":{\"fontSize\":12,\"openLinksInNewTab\":false,\"markdown\":\"Hello, world!\"}}"},"coreMigrationVersion":"8.0.0","migrationVersion":{"visualization":"7.14.0"},"references":[],"type":"visualization","updated_at":"2021-08-11T17:04:25.480Z","namespace":"test3"}
{"index":{"_id":"legacy-url-alias:test2:visualization:2e73ed30-fac6-11eb-9948-551479ec02ae-test2"}}
{"legacy-url-alias":{"targetNamespace":"test2","targetType":"visualization","targetId":"2e73ed30-fac6-11eb-9948-551479ec02ae-test2-newId","sourceId":"2e73ed30-fac6-11eb-9948-551479ec02ae-test2"},"type":"legacy-url-alias","references":[]}
{"index":{"_id":"legacy-url-alias:test3:visualization:2e73ed30-fac6-11eb-9948-551479ec02ae-test3"}}
{"legacy-url-alias":{"targetNamespace":"test3","targetType":"visualization","targetId":"2e73ed30-fac6-11eb-9948-551479ec02ae-test3-newId","sourceId":"2e73ed30-fac6-11eb-9948-551479ec02ae-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"}

Then, running the curl commands:

% curl -sSu elastic:changeme http://localhost:5601/s/test1/api/saved_objects/resolve/visualization/2e73ed30-fac6-11eb-9948-551479ec02ae-test1 | npx -q json
{
  "saved_object": {
    "id": "2e73ed30-fac6-11eb-9948-551479ec02ae-test1",
    "type": "visualization",
    "namespaces": [
      "test1"
    ],
    "updated_at": "2021-08-11T17:04:25.480Z",
    "version": "WzE1NSwxXQ==",
    "attributes": {
      "description": "",
      "kibanaSavedObjectMeta": {
        "searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}"
      },
      "title": "Test viz",
      "uiStateJSON": "{}",
      "version": 1,
      "visState": "{\"title\":\"Test viz\",\"type\":\"markdown\",\"aggs\":[],\"params\":{\"fontSize\":12,\"openLinksInNewTab\":false,\"markdown\":\"Hello, world!\"}}"
    },
    "references": [],
    "migrationVersion": {
      "visualization": "7.14.0"
    },
    "coreMigrationVersion": "8.0.0"
  },
  "outcome": "exactMatch"
}
% curl -sSu elastic:changeme http://localhost:5601/s/test2/api/saved_objects/resolve/visualization/2e73ed30-fac6-11eb-9948-551479ec02ae-test2 | npx -q json
{
  "saved_object": {
    "id": "2e73ed30-fac6-11eb-9948-551479ec02ae-test2-newId",
    "type": "visualization",
    "namespaces": [
      "test2"
    ],
    "updated_at": "2021-08-11T17:04:25.480Z",
    "version": "WzE1NiwxXQ==",
    "attributes": {
      "description": "",
      "kibanaSavedObjectMeta": {
        "searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}"
      },
      "title": "Test viz",
      "uiStateJSON": "{}",
      "version": 1,
      "visState": "{\"title\":\"Test viz\",\"type\":\"markdown\",\"aggs\":[],\"params\":{\"fontSize\":12,\"openLinksInNewTab\":false,\"markdown\":\"Hello, world!\"}}"
    },
    "references": [],
    "migrationVersion": {
      "visualization": "7.14.0"
    },
    "coreMigrationVersion": "8.0.0"
  },
  "outcome": "aliasMatch",
  "alias_target_id": "2e73ed30-fac6-11eb-9948-551479ec02ae-test2-newId"
}
% curl -sSu elastic:changeme http://localhost:5601/s/test3/api/saved_objects/resolve/visualization/2e73ed30-fac6-11eb-9948-551479ec02ae-test3 | npx -q json
{
  "saved_object": {
    "id": "2e73ed30-fac6-11eb-9948-551479ec02ae-test3",
    "type": "visualization",
    "namespaces": [
      "test3"
    ],
    "updated_at": "2021-08-11T17:04:25.480Z",
    "version": "WzE1NywxXQ==",
    "attributes": {
      "description": "",
      "kibanaSavedObjectMeta": {
        "searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}"
      },
      "title": "Test viz",
      "uiStateJSON": "{}",
      "version": 1,
      "visState": "{\"title\":\"Test viz\",\"type\":\"markdown\",\"aggs\":[],\"params\":{\"fontSize\":12,\"openLinksInNewTab\":false,\"markdown\":\"Hello, world!\"}}"
    },
    "references": [],
    "migrationVersion": {
      "visualization": "7.14.0"
    },
    "coreMigrationVersion": "8.0.0"
  },
  "outcome": "conflict",
  "alias_target_id": "2e73ed30-fac6-11eb-9948-551479ec02ae-test3-newId"
}

@jportner jportner marked this pull request as ready for review August 2, 2021 17:09
@jportner jportner requested review from a team as code owners August 2, 2021 17:09
@azasypkin azasypkin self-requested a review August 3, 2021 12:39
@azasypkin
Copy link
Member

ACK: reviewing...

Copy link
Member

@azasypkin azasypkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome job, learned a lot! 🙂 LGTM

docs/developer/advanced/sharing-saved-objects.asciidoc Outdated Show resolved Hide resolved
docs/developer/advanced/sharing-saved-objects.asciidoc Outdated Show resolved Hide resolved
docs/developer/advanced/sharing-saved-objects.asciidoc Outdated Show resolved Hide resolved
docs/developer/advanced/sharing-saved-objects.asciidoc Outdated Show resolved Hide resolved
docs/developer/advanced/sharing-saved-objects.asciidoc Outdated Show resolved Hide resolved
docs/developer/advanced/sharing-saved-objects.asciidoc Outdated Show resolved Hide resolved
docs/developer/advanced/sharing-saved-objects.asciidoc Outdated Show resolved Hide resolved
@jportner jportner requested a review from a team August 3, 2021 16:30
@jportner
Copy link
Contributor Author

jportner commented Aug 3, 2021

@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?

Copy link
Contributor

@KOTungseth KOTungseth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .asciidoc changes LGTM, but for the developer docs, @stacey-gammon might want to take a look.

@jportner jportner requested a review from rudolf August 9, 2021 15:25
* 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.
@jportner jportner enabled auto-merge (squash) August 10, 2021 14:13
@jportner jportner added the auto-backport Deprecated - use backport:version if exact versions are needed label Aug 10, 2021
@jportner
Copy link
Contributor Author

@elasticmachine merge upstream

@jportner
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
core 423.4KB 423.4KB +7.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@jportner jportner merged commit c21272c into elastic:master Aug 10, 2021
@jportner jportner deleted the issue-88744-sharing-saved-objects-guide branch August 10, 2021 22:04
@jportner jportner removed the auto-backport Deprecated - use backport:version if exact versions are needed label Aug 11, 2021
jportner added a commit to jportner/kibana that referenced this pull request Aug 11, 2021
# Conflicts:
#	docs/developer/advanced/index.asciidoc
jportner added a commit that referenced this pull request Aug 11, 2021
# Conflicts:
#	docs/developer/advanced/index.asciidoc
@mbondyra
Copy link
Contributor

mbondyra commented Sep 21, 2021

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.
And yet then, when going to the new spaces, I see no new visualizations created - so spaces are created correctly, but not visualizations.
Same when I check by curl -sSu elastic:changeme http://localhost:5601/s/test1/api/saved_objects/resolve/lens/725a2be0-1ace-11ec-acee-9f628a4e2e5b-test1 | npx -q json, 404s everywhere.

Am I missing something or something got broken?

export.ndjson.zip

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
#! this request accesses system indices: [.kibana_8.0.0_001], but in a future major version, direct access to system indices will be prevented by default
{
  "took" : 53,
  "errors" : false,
  "items" : [
    {
      "index" : {
        "_index" : ".kibana_8.0.0_001",
        "_id" : "space:test1",
        "_version" : 10,
        "result" : "updated",
        "_shards" : {
          "total" : 1,
          "successful" : 1,
          "failed" : 0
        },
        "_seq_no" : 734,
        "_primary_term" : 1,
        "status" : 200
      }
    },
    {
      "index" : {
        "_index" : ".kibana_8.0.0_001",
        "_id" : "space:test2",
        "_version" : 10,
        "result" : "updated",
        "_shards" : {
          "total" : 1,
          "successful" : 1,
          "failed" : 0
        },
        "_seq_no" : 735,
        "_primary_term" : 1,
        "status" : 200
      }
    },
    {
      "index" : {
        "_index" : ".kibana_8.0.0_001",
        "_id" : "space:test3",
        "_version" : 10,
        "result" : "updated",
        "_shards" : {
          "total" : 1,
          "successful" : 1,
          "failed" : 0
        },
        "_seq_no" : 736,
        "_primary_term" : 1,
        "status" : 200
      }
    },
    {
      "index" : {
        "_index" : ".kibana_8.0.0_001",
        "_id" : "index-pattern:d3d7af60-4c81-11e8-b3d7-01146121b73d",
        "_version" : 6,
        "result" : "updated",
        "_shards" : {
          "total" : 1,
          "successful" : 1,
          "failed" : 0
        },
        "_seq_no" : 737,
        "_primary_term" : 1,
        "status" : 200
      }
    },
    {
      "index" : {
        "_index" : ".kibana_8.0.0_001",
        "_id" : "test1:lens:725a2be0-1ace-11ec-acee-9f628a4e2e5b-test1",
        "_version" : 3,
        "result" : "updated",
        "_shards" : {
          "total" : 1,
          "successful" : 1,
          "failed" : 0
        },
        "_seq_no" : 738,
        "_primary_term" : 1,
        "status" : 200
      }
    },
    {
      "index" : {
        "_index" : ".kibana_8.0.0_001",
        "_id" : "test2:lens:725a2be0-1ace-11ec-acee-9f628a4e2e5b-test2-newId",
        "_version" : 3,
        "result" : "updated",
        "_shards" : {
          "total" : 1,
          "successful" : 1,
          "failed" : 0
        },
        "_seq_no" : 739,
        "_primary_term" : 1,
        "status" : 200
      }
    },
    {
      "index" : {
        "_index" : ".kibana_8.0.0_001",
        "_id" : "test3:lens:725a2be0-1ace-11ec-acee-9f628a4e2e5b-test3",
        "_version" : 3,
        "result" : "updated",
        "_shards" : {
          "total" : 1,
          "successful" : 1,
          "failed" : 0
        },
        "_seq_no" : 740,
        "_primary_term" : 1,
        "status" : 200
      }
    },
    {
      "index" : {
        "_index" : ".kibana_8.0.0_001",
        "_id" : "test3:lens:725a2be0-1ace-11ec-acee-9f628a4e2e5b-test3-newId",
        "_version" : 3,
        "result" : "updated",
        "_shards" : {
          "total" : 1,
          "successful" : 1,
          "failed" : 0
        },
        "_seq_no" : 741,
        "_primary_term" : 1,
        "status" : 200
      }
    },
    {
      "index" : {
        "_index" : ".kibana_8.0.0_001",
        "_id" : "legacy-url-alias:test2:lens:725a2be0-1ace-11ec-acee-9f628a4e2e5b-test2",
        "_version" : 3,
        "result" : "updated",
        "_shards" : {
          "total" : 1,
          "successful" : 1,
          "failed" : 0
        },
        "_seq_no" : 742,
        "_primary_term" : 1,
        "status" : 200
      }
    },
    {
      "index" : {
        "_index" : ".kibana_8.0.0_001",
        "_id" : "legacy-url-alias:test3:lens:725a2be0-1ace-11ec-acee-9f628a4e2e5b-test3",
        "_version" : 3,
        "result" : "updated",
        "_shards" : {
          "total" : 1,
          "successful" : 1,
          "failed" : 0
        },
        "_seq_no" : 743,
        "_primary_term" : 1,
        "status" : 200
      }
    }
  ]
}

@jportner
Copy link
Contributor Author

jportner commented Sep 27, 2021

Am I missing something or something got broken?

What version of the script did you use? The current version (attached in the comment above) is v1.3.
When I run the script I pick option 1 for index-pattern and option 2 for lens:

Click to expand
% node generate_resolve_staging_data.js ~/Downloads/export.ndjson 

Note, this script will generate staging data to allow you to exercise the three different SavedObjectsClient.resolve() outcomes. HOWEVER, this is NOT a 100% realistic representation of objects that have been converted to become share-capable. When you implement the actual conversion, you should write integration tests to ensure that objects are migrated as expected.

How is the "index-pattern" object type CURRENTLY registered?
  [1] namespaceType: 'single' (default)
  [2] namespaceType: 'multiple-isolated'
  [3] namespaceType: 'multiple'
  [4] namespaceType: 'agnostic'
1
How is the "lens" object type CURRENTLY registered?
  [1] namespaceType: 'single' (default)
  [2] namespaceType: 'multiple-isolated'
  [3] namespaceType: 'multiple'
  [4] namespaceType: 'agnostic'
2
--------------------
Wrote staging data to "/Users/joe/GitHub/generate_resolve_staging_data/resolve-staging-data.txt", use Kibana Dev Tools to add it to your instance! Example:
  POST .kibana/_bulk
  {"index":{"_id":"test1:index-pattern:d3d7af60-4c81-11e8-b3d7-01146121b73d-test1"}}
  ...

After loading staging data, test the different outcomes using the following CURL commands:
  curl -sSu elastic:changeme http://localhost:5601/s/test1/api/saved_objects/resolve/lens/725a2be0-1ace-11ec-acee-9f628a4e2e5b-test1 | npx -q json
  curl -sSu elastic:changeme http://localhost:5601/s/test2/api/saved_objects/resolve/lens/725a2be0-1ace-11ec-acee-9f628a4e2e5b-test2 | npx -q json
  curl -sSu elastic:changeme http://localhost:5601/s/test3/api/saved_objects/resolve/lens/725a2be0-1ace-11ec-acee-9f628a4e2e5b-test3 | npx -q json
(note, URLs need to be modified if you are running Kibana with a basePath)
--------------------

That gives me this staging data:

Click to expand
POST .kibana/_bulk
{"index":{"_id":"test1:index-pattern:d3d7af60-4c81-11e8-b3d7-01146121b73d-test1"}}
{"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","namespace":"test1"}
{"index":{"_id":"test2:index-pattern:d3d7af60-4c81-11e8-b3d7-01146121b73d-test2-newId"}}
{"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","namespace":"test2"}
{"index":{"_id":"test3:index-pattern:d3d7af60-4c81-11e8-b3d7-01146121b73d-test3"}}
{"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","namespace":"test3"}
{"index":{"_id":"test3:index-pattern:d3d7af60-4c81-11e8-b3d7-01146121b73d-test3-newId"}}
{"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","namespace":"test3"}
{"index":{"_id":"legacy-url-alias:test2:index-pattern:d3d7af60-4c81-11e8-b3d7-01146121b73d-test2"}}
{"legacy-url-alias":{"targetNamespace":"test2","targetType":"index-pattern","targetId":"d3d7af60-4c81-11e8-b3d7-01146121b73d-test2-newId","sourceId":"d3d7af60-4c81-11e8-b3d7-01146121b73d-test2"},"type":"legacy-url-alias","references":[]}
{"index":{"_id":"legacy-url-alias:test3:index-pattern:d3d7af60-4c81-11e8-b3d7-01146121b73d-test3"}}
{"legacy-url-alias":{"targetNamespace":"test3","targetType":"index-pattern","targetId":"d3d7af60-4c81-11e8-b3d7-01146121b73d-test3-newId","sourceId":"d3d7af60-4c81-11e8-b3d7-01146121b73d-test3"},"type":"legacy-url-alias","references":[]}
{"index":{"_id":"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","namespaces":["test1"]}
{"index":{"_id":"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","namespaces":["test2"]}
{"index":{"_id":"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","namespaces":["test3"]}
{"index":{"_id":"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","namespaces":["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"}

This 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.
I started a fresh Kibana instance, added the "Flights" sample data, then added the staging data above, and it appears the Lens with "aliasMatch" outcome (Test 2) runs into a problem when trying to load the index pattern.
I'll create a separate issue for that and link it here.

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes v7.15.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Docs] Create release note guide for Sharing Saved Objects breaking changes
6 participants