diff --git a/src/legacy/core_plugins/kibana/server/lib/__tests__/relationships.js b/src/legacy/core_plugins/kibana/server/lib/__tests__/relationships.js index e546255f94d3b2..69ca2d3496d709 100644 --- a/src/legacy/core_plugins/kibana/server/lib/__tests__/relationships.js +++ b/src/legacy/core_plugins/kibana/server/lib/__tests__/relationships.js @@ -56,12 +56,12 @@ describe('findRelationships', () => { ], }) }; - const result = await findRelationships( + const result = await findRelationships({ type, id, size, savedObjectsClient - ); + }); expect(result).to.eql([ { id: '1', title: 'Foo', type: 'visualization' }, { id: '2', title: 'Bar', type: 'visualization' }, @@ -114,12 +114,12 @@ describe('findRelationships', () => { }) }; - const result = await findRelationships( + const result = await findRelationships({ type, id, size, savedObjectsClient - ); + }); expect(result).to.eql([ { id: '1', title: 'My Dashboard', type: 'dashboard' }, { id: '2', title: 'Your Dashboard', type: 'dashboard' }, @@ -177,12 +177,12 @@ describe('findRelationships', () => { }) }; - const result = await findRelationships( + const result = await findRelationships({ type, id, size, savedObjectsClient - ); + }); expect(result).to.eql([ { id: '1', title: 'Foo', type: 'visualization' }, { id: '2', title: 'Bar', type: 'visualization' }, @@ -282,12 +282,12 @@ describe('findRelationships', () => { } }; - const result = await findRelationships( + const result = await findRelationships({ type, id, size, savedObjectsClient - ); + }); expect(result).to.eql([ { id: '1', type: 'visualization', title: 'Foo' }, { id: '2', type: 'visualization', title: 'Bar' }, @@ -298,7 +298,7 @@ describe('findRelationships', () => { it('should return an empty object for invalid types', async () => { const type = 'invalid'; - const result = await findRelationships(type); + const result = await findRelationships({ type }); expect(result).to.eql({}); }); }); diff --git a/src/legacy/core_plugins/kibana/server/lib/export/collect_references_deep.js b/src/legacy/core_plugins/kibana/server/lib/export/collect_references_deep.js index e34be90d12ecb5..e653a84800966d 100644 --- a/src/legacy/core_plugins/kibana/server/lib/export/collect_references_deep.js +++ b/src/legacy/core_plugins/kibana/server/lib/export/collect_references_deep.js @@ -26,17 +26,13 @@ export async function collectReferencesDeep(savedObjectClient, objects) { const itemsToGet = queue.splice(0, queue.length); const { saved_objects: savedObjects } = await savedObjectClient.bulkGet(itemsToGet); result.push(...savedObjects); - // All references will be replaced with references once all saved object types are migrated - const allReferences = []; - savedObjects.forEach((obj) => { - allReferences.push(...(obj.references || [])); - allReferences.push(...extractLegacyReferences(obj)); - }); - for (const reference of allReferences) { - const isInResult = result.findIndex(obj => obj.type === reference.type && obj.id === reference.id) !== -1; - if (isInResult) continue; - const isInQueue = queue.findIndex(obj => obj.type === reference.type && obj.id === reference.id) !== -1; - if (isInQueue) continue; + const references = [] + .concat(...savedObjects.map(obj => obj.references || [])) + // This line below will be removed once legacy support is removed + .concat(...savedObjects.map(obj => extractLegacyReferences(obj))); + for (const reference of references) { + const isDuplicate = result.concat(queue).some(obj => obj.type === reference.type && obj.id === reference.id); + if (isDuplicate) continue; queue.push({ type: reference.type, id: reference.id }); } } @@ -56,7 +52,7 @@ function extractLegacyReferences(savedObject) { panels = []; } for (const panel of panels) { - if (panel.type && panel.id) { + if (panel.type === 'visualization' && panel.id) { legacyReferences.push({ type: panel.type, id: panel.id }); } } diff --git a/src/legacy/core_plugins/kibana/server/lib/management/saved_objects/relationships.js b/src/legacy/core_plugins/kibana/server/lib/management/saved_objects/relationships.js index cf2d85ccceffbc..11558f8fe00540 100644 --- a/src/legacy/core_plugins/kibana/server/lib/management/saved_objects/relationships.js +++ b/src/legacy/core_plugins/kibana/server/lib/management/saved_objects/relationships.js @@ -17,8 +17,8 @@ * under the License. */ -async function findDashboardRelationships(id, size, savedObjectsClient) { - const dashboard = await savedObjectsClient.get('dashboard', id); +async function findDashboardRelationships({ id, size, namespace, savedObjectsClient }) { + const dashboard = await savedObjectsClient.get('dashboard', id, { namespace }); const visualizations = []; // TODO: should we handle exceptions here or at the parent level? @@ -29,7 +29,8 @@ async function findDashboardRelationships(id, size, savedObjectsClient) { visualizationIds.slice(0, size).map(id => ({ id, type: 'visualization', - })) + })), + { namespace } ); visualizations.push( @@ -49,9 +50,10 @@ async function findDashboardRelationships(id, size, savedObjectsClient) { return visualizations; } -async function findVisualizationRelationships(id, size, savedObjectsClient) { - await savedObjectsClient.get('visualization', id); +async function findVisualizationRelationships({ id, size, namespace, savedObjectsClient }) { + await savedObjectsClient.get('visualization', id, { namespace }); const allDashboardsResponse = await savedObjectsClient.find({ + namespace, type: 'dashboard', fields: ['title', 'panelsJSON'], }); @@ -81,20 +83,21 @@ async function findVisualizationRelationships(id, size, savedObjectsClient) { return dashboards; } -async function findSavedSearchRelationships(id, size, savedObjectsClient) { - const search = await savedObjectsClient.get('search', id); +async function findSavedSearchRelationships({ id, namespace, savedObjectsClient }) { + const search = await savedObjectsClient.get('search', id, { namespace }); const searchSourceJSON = JSON.parse(search.attributes.kibanaSavedObjectMeta.searchSourceJSON); const indexPatterns = []; try { - const indexPattern = await savedObjectsClient.get('index-pattern', searchSourceJSON.index); + const indexPattern = await savedObjectsClient.get('index-pattern', searchSourceJSON.index, { namespace }); indexPatterns.push({ id: indexPattern.id, type: 'index-pattern', title: indexPattern.attributes.title }); } catch (err) { // Do nothing } const allVisualizationsResponse = await savedObjectsClient.find({ + namespace, type: 'visualization', searchFields: ['savedSearchId'], search: id, @@ -115,16 +118,18 @@ async function findSavedSearchRelationships(id, size, savedObjectsClient) { return visualizations.concat(indexPatterns); } -async function findIndexPatternRelationships(id, size, savedObjectsClient) { - await savedObjectsClient.get('index-pattern', id); +async function findIndexPatternRelationships({ id, size, namespace, savedObjectsClient }) { + await savedObjectsClient.get('index-pattern', id, { namespace }); const [allVisualizationsResponse, savedSearchResponse] = await Promise.all([ savedObjectsClient.find({ + namespace, type: 'visualization', searchFields: ['kibanaSavedObjectMeta.searchSourceJSON'], search: '*', fields: [`title`, `kibanaSavedObjectMeta.searchSourceJSON`], }), savedObjectsClient.find({ + namespace, type: 'search', searchFields: ['kibanaSavedObjectMeta.searchSourceJSON'], search: '*', @@ -172,16 +177,16 @@ async function findIndexPatternRelationships(id, size, savedObjectsClient) { return visualizations.concat(searches); } -export async function findRelationships(type, id, size, savedObjectsClient) { +export async function findRelationships({ type, id, namespace, size, savedObjectsClient }) { switch (type) { case 'dashboard': - return await findDashboardRelationships(id, size, savedObjectsClient); + return await findDashboardRelationships({ id, size, namespace, savedObjectsClient }); case 'visualization': - return await findVisualizationRelationships(id, size, savedObjectsClient); + return await findVisualizationRelationships({ id, size, namespace, savedObjectsClient }); case 'search': - return await findSavedSearchRelationships(id, size, savedObjectsClient); + return await findSavedSearchRelationships({ id, size, namespace, savedObjectsClient }); case 'index-pattern': - return await findIndexPatternRelationships(id, size, savedObjectsClient); + return await findIndexPatternRelationships({ id, size, namespace, savedObjectsClient }); } return []; } diff --git a/src/legacy/core_plugins/kibana/server/routes/api/management/saved_objects/relationships.js b/src/legacy/core_plugins/kibana/server/routes/api/management/saved_objects/relationships.js index 308ec1dd21ee50..99f745e902ed4b 100644 --- a/src/legacy/core_plugins/kibana/server/routes/api/management/saved_objects/relationships.js +++ b/src/legacy/core_plugins/kibana/server/routes/api/management/saved_objects/relationships.js @@ -38,7 +38,7 @@ export function registerRelationships(server) { handler: async (req) => { const type = req.params.type; const id = req.params.id; - const size = req.query.size || 10; + const size = req.query.size || 10000; const savedObjectsClient = req.getSavedObjectsClient(); return await savedObjectsClient.findRelationships(type, id, { size }); diff --git a/src/server/saved_objects/routes/bulk_get.test.js b/src/server/saved_objects/routes/bulk_get.test.js index e646629970fd43..62c155a57a165e 100644 --- a/src/server/saved_objects/routes/bulk_get.test.js +++ b/src/server/saved_objects/routes/bulk_get.test.js @@ -59,7 +59,8 @@ describe('POST /api/saved_objects/_bulk_get', () => { id: 'abc123', type: 'index-pattern', title: 'logstash-*', - version: 2 + version: 2, + references: [], }] }; diff --git a/src/server/saved_objects/routes/create.test.js b/src/server/saved_objects/routes/create.test.js index 48b6cb970e56b5..0a6679c9a05381 100644 --- a/src/server/saved_objects/routes/create.test.js +++ b/src/server/saved_objects/routes/create.test.js @@ -57,7 +57,8 @@ describe('POST /api/saved_objects/{type}', () => { const clientResponse = { type: 'index-pattern', id: 'logstash-*', - title: 'Testing' + title: 'Testing', + references: [], }; savedObjectsClient.create.returns(Promise.resolve(clientResponse)); diff --git a/src/server/saved_objects/routes/find.test.js b/src/server/saved_objects/routes/find.test.js index 3b1de7490367e1..404fab6c662ae9 100644 --- a/src/server/saved_objects/routes/find.test.js +++ b/src/server/saved_objects/routes/find.test.js @@ -74,13 +74,15 @@ describe('GET /api/saved_objects/_find', () => { id: 'logstash-*', title: 'logstash-*', timeFieldName: '@timestamp', - notExpandable: true + notExpandable: true, + references: [], }, { type: 'index-pattern', id: 'stocks-*', title: 'stocks-*', timeFieldName: '@timestamp', - notExpandable: true + notExpandable: true, + references: [], } ] }; diff --git a/src/server/saved_objects/routes/get.test.js b/src/server/saved_objects/routes/get.test.js index 63246bcf3a329c..52ccb38601fb7d 100644 --- a/src/server/saved_objects/routes/get.test.js +++ b/src/server/saved_objects/routes/get.test.js @@ -53,7 +53,8 @@ describe('GET /api/saved_objects/{type}/{id}', () => { id: 'logstash-*', title: 'logstash-*', timeFieldName: '@timestamp', - notExpandable: true + notExpandable: true, + references: [], }; savedObjectsClient.get.returns(Promise.resolve(clientResponse)); diff --git a/src/server/saved_objects/routes/update.test.js b/src/server/saved_objects/routes/update.test.js index ac4d938794fda7..e4095b14263be0 100644 --- a/src/server/saved_objects/routes/update.test.js +++ b/src/server/saved_objects/routes/update.test.js @@ -51,7 +51,8 @@ describe('PUT /api/saved_objects/{type}/{id?}', () => { payload: { attributes: { title: 'Testing' - } + }, + references: [], } }; diff --git a/src/server/saved_objects/serialization/index.ts b/src/server/saved_objects/serialization/index.ts index cc49e748cf6d33..89b4e987c54f4c 100644 --- a/src/server/saved_objects/serialization/index.ts +++ b/src/server/saved_objects/serialization/index.ts @@ -48,6 +48,15 @@ export interface MigrationVersion { [type: string]: string; } +/** + * A reference object to anohter saved object. + */ +export interface SavedObjectReference { + name: string; + type: string; + id: string; +} + /** * A saved object type definition that allows for miscellaneous, unknown * properties, as current discussions around security, ACLs, etc indicate @@ -62,7 +71,7 @@ export interface SavedObjectDoc { migrationVersion?: MigrationVersion; version?: number; updated_at?: Date; - references?: object[]; + references?: SavedObjectReference[]; [rootProp: string]: any; } diff --git a/src/server/saved_objects/serialization/serialization.test.ts b/src/server/saved_objects/serialization/serialization.test.ts index 686acf8521e364..e28191ea4e0795 100644 --- a/src/server/saved_objects/serialization/serialization.test.ts +++ b/src/server/saved_objects/serialization/serialization.test.ts @@ -34,6 +34,24 @@ describe('saved object conversion', () => { expect(actual).toHaveProperty('type', 'foo'); }); + test('it copies the _source.references property to references', () => { + const serializer = new SavedObjectsSerializer(new SavedObjectsSchema()); + const actual = serializer.rawToSavedObject({ + _id: 'foo:bar', + _source: { + type: 'foo', + references: [{ name: 'ref_0', type: 'index-pattern', id: 'pattern*' }], + }, + }); + expect(actual).toHaveProperty('references', [ + { + name: 'ref_0', + type: 'index-pattern', + id: 'pattern*', + }, + ]); + }); + test('if specified it copies the _source.migrationVersion property to migrationVersion', () => { const serializer = new SavedObjectsSerializer(new SavedObjectsSchema()); const actual = serializer.rawToSavedObject({ @@ -391,6 +409,23 @@ describe('saved object conversion', () => { expect(actual._source).toHaveProperty('type', 'foo'); }); + test('it copies the references property to _source.references', () => { + const serializer = new SavedObjectsSerializer(new SavedObjectsSchema()); + const actual = serializer.savedObjectToRaw({ + id: '1', + type: 'foo', + attributes: {}, + references: [{ name: 'ref_0', type: 'index-pattern', id: 'pattern*' }], + }); + expect(actual._source).toHaveProperty('references', [ + { + name: 'ref_0', + type: 'index-pattern', + id: 'pattern*', + }, + ]); + }); + test('if specified it copies the updated_at property to _source.updated_at', () => { const serializer = new SavedObjectsSerializer(new SavedObjectsSchema()); const now = new Date(); diff --git a/src/server/saved_objects/service/lib/relationship_query_builder.test.ts b/src/server/saved_objects/service/lib/relationship_query_builder.test.ts index e2d3c5c027c612..4d7ba8f9a48338 100644 --- a/src/server/saved_objects/service/lib/relationship_query_builder.test.ts +++ b/src/server/saved_objects/service/lib/relationship_query_builder.test.ts @@ -20,7 +20,7 @@ import { getRelationshipsQuery } from './relationship_query_builder'; test('Filters a targeted type for a source object', () => { - const query = getRelationshipsQuery({ type: 'search', id: '123' }); + const query = getRelationshipsQuery({ type: 'search', id: '123', filterTypes: ['my-type'] }); expect(query).toMatchInlineSnapshot(` Object { "bool": Object { @@ -36,6 +36,15 @@ Object { }, }, }, + Array [ + Object { + "terms": Object { + "type": Array [ + "my-type", + ], + }, + }, + ], Object { "nested": Object { "path": "references", @@ -66,7 +75,12 @@ Object { }); test('Filters by namespace', () => { - const query = getRelationshipsQuery({ type: 'search', id: '123', namespace: 'my-namespace' }); + const query = getRelationshipsQuery({ + type: 'search', + id: '123', + namespace: 'my-namespace', + filterTypes: ['my-type'], + }); expect(query).toMatchInlineSnapshot(` Object { "bool": Object { @@ -78,6 +92,15 @@ Object { "namespace": "my-namespace", }, }, + Array [ + Object { + "terms": Object { + "type": Array [ + "my-type", + ], + }, + }, + ], Object { "nested": Object { "path": "references", diff --git a/src/server/saved_objects/service/lib/relationship_query_builder.ts b/src/server/saved_objects/service/lib/relationship_query_builder.ts index fc625e48617579..946aa2a48c9f46 100644 --- a/src/server/saved_objects/service/lib/relationship_query_builder.ts +++ b/src/server/saved_objects/service/lib/relationship_query_builder.ts @@ -21,11 +21,11 @@ interface RelationshipQueryOptions { type: string; id: string; namespace?: string; - searchTypes?: string[]; + filterTypes: string[]; } export function getRelationshipsQuery(options: RelationshipQueryOptions) { - const { type, id, namespace, searchTypes } = options; + const { type, id, namespace, filterTypes } = options; return { bool: { filter: { @@ -34,7 +34,7 @@ export function getRelationshipsQuery(options: RelationshipQueryOptions) { ...(namespace ? [{ term: { namespace } }] : [{ bool: { must_not: { exists: { field: 'namespace' } } } }]), - ...(searchTypes ? [{ terms: { type: searchTypes } }] : []), + [{ terms: { type: filterTypes } }], { nested: { path: 'references', diff --git a/src/server/saved_objects/service/lib/repository.js b/src/server/saved_objects/service/lib/repository.js index 0bd6097ffc570d..a51748040f58c6 100644 --- a/src/server/saved_objects/service/lib/repository.js +++ b/src/server/saved_objects/service/lib/repository.js @@ -608,7 +608,7 @@ export class SavedObjectsRepository { const { size = 10000, namespace, - filterTypes, + filterTypes = Object.keys(getRootPropertiesObjects(this._mappings)), } = options; if (!id || typeof id !== 'string') { @@ -619,42 +619,37 @@ export class SavedObjectsRepository { throw new TypeError('type must be a string'); } - const sourceObject = await this.get(type, id, { namespace }); - - // This code will be removed as these types migrate to use "references" - let legacyFindRelationshipsCall; - if (['dashboard', 'visualization', 'search', 'index-pattern'].includes(type)) { - legacyFindRelationshipsCall = legacyFindRelationships(type, id, size, this); - } - const bulkGetOpts = (sourceObject.references || []).map(ref => ({ id: ref.id, type: ref.type })); - const searchTypes = Array.isArray(filterTypes) - ? filterTypes - : Object.keys(getRootPropertiesObjects(this._mappings)); + const { references = [] } = await this.get(type, id, { namespace }); + const bulkGetOpts = references + .filter(ref => filterTypes.includes(ref.type)) + .map(ref => ({ id: ref.id, type: ref.type })); + const searchOpts = { + index: this._index, + size, + from: 0, + _source: [ + 'type', + 'namespace', + ...(filterTypes.map(type => `${type}.title`)), + ], + ignore: [404], + rest_total_hits_as_int: true, + body: { + version: true, + query: getRelationshipsQuery({ type, id, namespace, filterTypes }) + } + }; const [{ saved_objects: referencedObjects }, referencedResponse, legacyResponse] = await Promise.all([ this.bulkGet(bulkGetOpts), - this._callCluster('search', { - index: this._index, - size, - from: 0, - _source: [ - 'type', - 'namespace', - ...(searchTypes.map(type => `${type}.title`)), - ], - ignore: [404], - rest_total_hits_as_int: true, - body: { - version: true, - query: getRelationshipsQuery({ type, id, namespace, searchTypes }) - } - }), - legacyFindRelationshipsCall, + this._callCluster('search', searchOpts), + // This code will be removed as these types migrate to use "references" + legacyFindRelationships({ type, size, namespace, id, savedObjectsClient: this }), ]); const relationshipObjects = [].concat( referencedObjects.map(obj => ({ id: obj.id, type: obj.type, ...obj.attributes })), - legacyResponse || [], + legacyResponse.filter(obj => filterTypes.includes(obj.type)), referencedResponse.hits.hits .map(hit => this._rawToSavedObject(hit)) .map(obj => ({ id: obj.id, type: obj.type, ...obj.attributes })) @@ -664,8 +659,8 @@ export class SavedObjectsRepository { const objectsForType = (result[relationshipObject.type] || []); // Since we're supporting the legacy method until all saved objects use "references", // remove duplicates until then. - if (objectsForType.find(obj => obj.id === relationshipObject.id)) return result; - const type = relationshipObject.type; + if (objectsForType.some(obj => obj.id === relationshipObject.id)) return result; + const { type } = relationshipObject; delete relationshipObject.type; result[type] = objectsForType.concat(relationshipObject); return result; diff --git a/src/server/saved_objects/service/saved_objects_client.d.ts b/src/server/saved_objects/service/saved_objects_client.d.ts index a69baf5f82c1e9..a6cf231bb77b55 100644 --- a/src/server/saved_objects/service/saved_objects_client.d.ts +++ b/src/server/saved_objects/service/saved_objects_client.d.ts @@ -80,6 +80,13 @@ export interface SavedObject { message: string; }; attributes: SavedObjectAttributes; + references: SavedObjectReference[]; +} + +export interface SavedObjectReference { + name: string; + type: string; + id: string; } export interface FindRelationshipsOptions { diff --git a/x-pack/plugins/spaces/server/lib/saved_objects_client/spaces_saved_objects_client.test.ts b/x-pack/plugins/spaces/server/lib/saved_objects_client/spaces_saved_objects_client.test.ts index 5a6ca30dba8334..4dcbf222ca2bd2 100644 --- a/x-pack/plugins/spaces/server/lib/saved_objects_client/spaces_saved_objects_client.test.ts +++ b/x-pack/plugins/spaces/server/lib/saved_objects_client/spaces_saved_objects_client.test.ts @@ -38,6 +38,7 @@ const createMockClient = () => { bulkCreate: jest.fn(), update: jest.fn(), delete: jest.fn(), + findRelationships: jest.fn(), errors, }; }; diff --git a/x-pack/test/saved_object_api_integration/common/fixtures/es_archiver/saved_objects/spaces/data.json b/x-pack/test/saved_object_api_integration/common/fixtures/es_archiver/saved_objects/spaces/data.json index 5da6fb43ff1d45..629bb3de0c8428 100644 --- a/x-pack/test/saved_object_api_integration/common/fixtures/es_archiver/saved_objects/spaces/data.json +++ b/x-pack/test/saved_object_api_integration/common/fixtures/es_archiver/saved_objects/spaces/data.json @@ -195,7 +195,7 @@ "description": "", "version": 1, "kibanaSavedObjectMeta": { - "searchSourceJSON": "{\"index\":\"91200a00-9efd-11e7-acb3-3dab96693fab\",\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"}}" + "searchSourceJSON": "{\"index\":\"space_1-91200a00-9efd-11e7-acb3-3dab96693fab\",\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"}}" } } } @@ -216,7 +216,7 @@ "title": "Requests", "hits": 0, "description": "", - "panelsJSON": "[{\"size_x\":6,\"size_y\":3,\"panelIndex\":1,\"type\":\"visualization\",\"id\":\"dd7caf20-9efd-11e7-acb3-3dab96693fab\",\"col\":1,\"row\":1}]", + "panelsJSON": "[{\"size_x\":6,\"size_y\":3,\"panelIndex\":1,\"type\":\"visualization\",\"id\":\"space_1-dd7caf20-9efd-11e7-acb3-3dab96693fab\",\"col\":1,\"row\":1}]", "optionsJSON": "{\"darkTheme\":false}", "uiStateJSON": "{}", "version": 1, @@ -291,7 +291,7 @@ "description": "", "version": 1, "kibanaSavedObjectMeta": { - "searchSourceJSON": "{\"index\":\"91200a00-9efd-11e7-acb3-3dab96693fab\",\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"}}" + "searchSourceJSON": "{\"index\":\"space_2-91200a00-9efd-11e7-acb3-3dab96693fab\",\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"}}" } } } @@ -312,7 +312,7 @@ "title": "Requests", "hits": 0, "description": "", - "panelsJSON": "[{\"size_x\":6,\"size_y\":3,\"panelIndex\":1,\"type\":\"visualization\",\"id\":\"dd7caf20-9efd-11e7-acb3-3dab96693fab\",\"col\":1,\"row\":1}]", + "panelsJSON": "[{\"size_x\":6,\"size_y\":3,\"panelIndex\":1,\"type\":\"visualization\",\"id\":\"space_2-dd7caf20-9efd-11e7-acb3-3dab96693fab\",\"col\":1,\"row\":1}]", "optionsJSON": "{\"darkTheme\":false}", "uiStateJSON": "{}", "version": 1, diff --git a/x-pack/test/saved_object_api_integration/common/suites/bulk_get.ts b/x-pack/test/saved_object_api_integration/common/suites/bulk_get.ts index aee45ed506d867..dc5b7eaf3c75e0 100644 --- a/x-pack/test/saved_object_api_integration/common/suites/bulk_get.ts +++ b/x-pack/test/saved_object_api_integration/common/suites/bulk_get.ts @@ -108,14 +108,6 @@ export function bulkGetTestSuiteFactory(esArchiver: any, supertest: SuperTest (resp: { [key: string]: any; }) => { - expect(resp.body).to.have.property('index-pattern'); + expect(resp.body).to.eql({ + dashboard: [ + { + id: `${getIdPrefix(spaceId)}be3733a0-9efe-11e7-acb3-3dab96693fab`, + title: 'Requests', + }, + ], + }); }; const makeFindRelationshipsTest = (describeFn: DescribeFn) => ( diff --git a/x-pack/test/saved_object_api_integration/common/suites/get.ts b/x-pack/test/saved_object_api_integration/common/suites/get.ts index 0fcba68621fe69..593bf098b08012 100644 --- a/x-pack/test/saved_object_api_integration/common/suites/get.ts +++ b/x-pack/test/saved_object_api_integration/common/suites/get.ts @@ -114,14 +114,6 @@ export function getTestSuiteFactory(esArchiver: any, supertest: SuperTest) uiStateJSON: resp.body.attributes.uiStateJSON, kibanaSavedObjectMeta: resp.body.attributes.kibanaSavedObjectMeta, }, - migrationVersion: resp.body.migrationVersion, - references: [ - { - id: '91200a00-9efd-11e7-acb3-3dab96693fab', - type: 'index-pattern', - name: 'kibanaSavedObjectMeta.searchSourceJSON.index', - }, - ], }); }; diff --git a/x-pack/test/saved_object_api_integration/security_and_spaces/apis/find_relationships.ts b/x-pack/test/saved_object_api_integration/security_and_spaces/apis/find_relationships.ts index 25c7e47bcc3743..0d6b258c505cb4 100644 --- a/x-pack/test/saved_object_api_integration/security_and_spaces/apis/find_relationships.ts +++ b/x-pack/test/saved_object_api_integration/security_and_spaces/apis/find_relationships.ts @@ -193,7 +193,7 @@ export default function({ getService }: TestInvoker) { }, }); - findRelationshipsTest(`rbac user with read globall within the ${scenario.spaceId} space`, { + findRelationshipsTest(`rbac user with read globally within the ${scenario.spaceId} space`, { user: scenario.users.readGlobally, spaceId: scenario.spaceId, tests: {