diff --git a/packages/kbn-test/src/kbn_client/kbn_client.ts b/packages/kbn-test/src/kbn_client/kbn_client.ts index 3fa74412c1a8bf2..ac14a399918cb93 100644 --- a/packages/kbn-test/src/kbn_client/kbn_client.ts +++ b/packages/kbn-test/src/kbn_client/kbn_client.ts @@ -8,13 +8,14 @@ import { ToolingLog } from '@kbn/dev-utils'; -import { KbnClientRequester, ReqOptions } from './kbn_client_requester'; -import { KbnClientStatus } from './kbn_client_status'; +import { KbnClientImportExport } from './kbn_client_import_export'; import { KbnClientPlugins } from './kbn_client_plugins'; -import { KbnClientVersion } from './kbn_client_version'; +import { KbnClientRequester, ReqOptions } from './kbn_client_requester'; import { KbnClientSavedObjects } from './kbn_client_saved_objects'; +import { KbnClientSpaces } from './kbn_client_spaces'; +import { KbnClientStatus } from './kbn_client_status'; import { KbnClientUiSettings, UiSettingValues } from './kbn_client_ui_settings'; -import { KbnClientImportExport } from './kbn_client_import_export'; +import { KbnClientVersion } from './kbn_client_version'; export interface KbnClientOptions { url: string; @@ -29,6 +30,7 @@ export class KbnClient { readonly plugins: KbnClientPlugins; readonly version: KbnClientVersion; readonly savedObjects: KbnClientSavedObjects; + readonly spaces: KbnClientSpaces; readonly uiSettings: KbnClientUiSettings; readonly importExport: KbnClientImportExport; @@ -59,6 +61,7 @@ export class KbnClient { this.plugins = new KbnClientPlugins(this.status); this.version = new KbnClientVersion(this.status); this.savedObjects = new KbnClientSavedObjects(this.log, this.requester); + this.spaces = new KbnClientSpaces(this.requester); this.uiSettings = new KbnClientUiSettings(this.log, this.requester, this.uiSettingDefaults); this.importExport = new KbnClientImportExport( this.log, diff --git a/packages/kbn-test/src/kbn_client/kbn_client_requester.ts b/packages/kbn-test/src/kbn_client/kbn_client_requester.ts index af75137d148e97c..a194b593b3863ab 100644 --- a/packages/kbn-test/src/kbn_client/kbn_client_requester.ts +++ b/packages/kbn-test/src/kbn_client/kbn_client_requester.ts @@ -121,6 +121,8 @@ export class KbnClientRequester { responseType: options.responseType, // work around https://github.com/axios/axios/issues/2791 transformResponse: options.responseType === 'text' ? [(x) => x] : undefined, + maxContentLength: 30000000, + maxBodyLength: 30000000, paramsSerializer: (params) => Qs.stringify(params), }); diff --git a/packages/kbn-test/src/kbn_client/kbn_client_spaces.ts b/packages/kbn-test/src/kbn_client/kbn_client_spaces.ts new file mode 100644 index 000000000000000..e88531606e91785 --- /dev/null +++ b/packages/kbn-test/src/kbn_client/kbn_client_spaces.ts @@ -0,0 +1,67 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { KbnClientRequester, uriencode } from './kbn_client_requester'; + +interface UpdateBody { + name: string; + description?: string; + disabledFeatures?: string | string[]; + initials?: string; + color?: string; + imageUrl?: string; +} + +interface CreateBody extends UpdateBody { + id: string; +} + +export class KbnClientSpaces { + constructor(private readonly requester: KbnClientRequester) {} + + async create(body: CreateBody) { + await this.requester.request({ + method: 'POST', + path: '/api/spaces/space', + body, + }); + } + + async update(id: string, body: UpdateBody) { + await this.requester.request({ + method: 'PUT', + path: uriencode`/api/spaces/space/${id}`, + body, + }); + } + + async get(id: string) { + const { data } = await this.requester.request({ + method: 'GET', + path: uriencode`/api/spaces/space/${id}`, + }); + + return data; + } + + async list() { + const { data } = await this.requester.request({ + method: 'GET', + path: '/api/spaces/space', + }); + + return data; + } + + async delete(id: string) { + await this.requester.request({ + method: 'DELETE', + path: uriencode`/api/spaces/space/${id}`, + }); + } +} diff --git a/src/dev/precommit_hook/casing_check_config.js b/src/dev/precommit_hook/casing_check_config.js index 5c736b35a47265c..f5b7f266a3166c9 100644 --- a/src/dev/precommit_hook/casing_check_config.js +++ b/src/dev/precommit_hook/casing_check_config.js @@ -40,6 +40,7 @@ export const IGNORE_FILE_GLOBS = [ '.ci/pipeline-library/**/*', 'packages/kbn-test/jest-preset.js', 'test/package/Vagrantfile', + '**/test/**/fixtures/**/*', // filename must match language code which requires capital letters '**/translations/*.json', @@ -60,8 +61,6 @@ export const IGNORE_FILE_GLOBS = [ 'x-pack/plugins/apm/e2e/**/*', 'x-pack/plugins/maps/server/fonts/**/*', - // packages for the ingest manager's api integration tests could be valid semver which has dashes - 'x-pack/test/fleet_api_integration/apis/fixtures/test_packages/**/*', // Bazel default files '**/WORKSPACE.bazel', @@ -97,7 +96,6 @@ export const IGNORE_DIRECTORY_GLOBS = [ ...KEBAB_CASE_DIRECTORY_GLOBS, 'src/babel-*', 'packages/*', - 'test/functional/fixtures/es_archiver/visualize_source-filters', 'packages/kbn-pm/src/utils/__fixtures__/*', 'x-pack/dev-tools', 'packages/kbn-optimizer/src/__fixtures__/mock_repo/x-pack', diff --git a/test/api_integration/apis/kql_telemetry/kql_telemetry.ts b/test/api_integration/apis/kql_telemetry/kql_telemetry.ts index f258804e7e12201..09e36b9078792a2 100644 --- a/test/api_integration/apis/kql_telemetry/kql_telemetry.ts +++ b/test/api_integration/apis/kql_telemetry/kql_telemetry.ts @@ -13,12 +13,12 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const esArchiver = getService('esArchiver'); + const kibanaServer = getService('kibanaServer'); const es = getService('es'); describe('telemetry API', () => { - before(() => esArchiver.load('test/api_integration/fixtures/es_archiver/saved_objects/basic')); - after(() => esArchiver.unload('test/api_integration/fixtures/es_archiver/saved_objects/basic')); + before(() => kibanaServer.importExport.load('saved_objects/basic')); + after(() => kibanaServer.importExport.unload('saved_objects/basic')); it('should increment the opt *in* counter in the .kibana/kql-telemetry document', async () => { await supertest diff --git a/test/api_integration/apis/saved_objects/bulk_create.ts b/test/api_integration/apis/saved_objects/bulk_create.ts index c898649449c09de..1f76567e973b224 100644 --- a/test/api_integration/apis/saved_objects/bulk_create.ts +++ b/test/api_integration/apis/saved_objects/bulk_create.ts @@ -12,8 +12,8 @@ import { getKibanaVersion } from './lib/saved_objects_test_utils'; export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const esArchiver = getService('esArchiver'); - const esDeleteAllIndices = getService('esDeleteAllIndices'); + const kibanaServer = getService('kibanaServer'); + const SPACE_ID = 'ftr-so-bulk-create'; const BULK_REQUESTS = [ { @@ -38,103 +38,58 @@ export default function ({ getService }: FtrProviderContext) { before(async () => { KIBANA_VERSION = await getKibanaVersion(getService); + await kibanaServer.spaces.create({ id: SPACE_ID, name: SPACE_ID }); + await kibanaServer.importExport.load('saved_objects/basic', { space: SPACE_ID }); }); - describe('with kibana index', () => { - before(() => - esArchiver.load('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); - after(() => - esArchiver.unload('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); + after(() => kibanaServer.spaces.delete(SPACE_ID)); - it('should return 200 with individual responses', async () => - await supertest - .post(`/api/saved_objects/_bulk_create`) - .send(BULK_REQUESTS) - .expect(200) - .then((resp) => { - expect(resp.body).to.eql({ - saved_objects: [ - { - type: 'visualization', - id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', - error: { - error: 'Conflict', - message: - 'Saved object [visualization/dd7caf20-9efd-11e7-acb3-3dab96693fab] conflict', - statusCode: 409, - }, + it('should return 200 with individual responses', async () => + await supertest + .post(`/s/${SPACE_ID}/api/saved_objects/_bulk_create`) + .send(BULK_REQUESTS) + .expect(200) + .then((resp) => { + expect(resp.body).to.eql({ + saved_objects: [ + { + type: 'visualization', + id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', + error: { + error: 'Conflict', + message: + 'Saved object [visualization/dd7caf20-9efd-11e7-acb3-3dab96693fab] conflict', + statusCode: 409, }, - { - type: 'dashboard', - id: 'a01b2f57-fcfd-4864-b735-09e28f0d815e', - updated_at: resp.body.saved_objects[1].updated_at, - version: resp.body.saved_objects[1].version, - attributes: { - title: 'A great new dashboard', - }, - migrationVersion: { - dashboard: resp.body.saved_objects[1].migrationVersion.dashboard, - }, - coreMigrationVersion: KIBANA_VERSION, - references: [], - namespaces: ['default'], + }, + { + type: 'dashboard', + id: 'a01b2f57-fcfd-4864-b735-09e28f0d815e', + updated_at: resp.body.saved_objects[1].updated_at, + version: resp.body.saved_objects[1].version, + attributes: { + title: 'A great new dashboard', }, - ], - }); - })); - - it('should not return raw id when object id is unspecified', async () => - await supertest - .post(`/api/saved_objects/_bulk_create`) - .send(BULK_REQUESTS.map(({ id, ...rest }) => rest)) - .expect(200) - .then((resp) => { - resp.body.saved_objects.map(({ id }: { id: string }) => - expect(id).not.match(/visualization|dashboard/) - ); - })); - }); - - describe('without kibana index', () => { - before( - async () => - // just in case the kibana server has recreated it - await esDeleteAllIndices('.kibana*') - ); - - it('should return 200 with errors', async () => { - await new Promise((resolve) => setTimeout(resolve, 2000)); - await supertest - .post('/api/saved_objects/_bulk_create') - .send(BULK_REQUESTS) - .expect(200) - .then((resp) => { - expect(resp.body).to.eql({ - saved_objects: [ - { - id: BULK_REQUESTS[0].id, - type: BULK_REQUESTS[0].type, - error: { - error: 'Internal Server Error', - message: 'An internal server error occurred', - statusCode: 500, - }, + migrationVersion: { + dashboard: resp.body.saved_objects[1].migrationVersion.dashboard, }, - { - id: BULK_REQUESTS[1].id, - type: BULK_REQUESTS[1].type, - error: { - error: 'Internal Server Error', - message: 'An internal server error occurred', - statusCode: 500, - }, - }, - ], - }); + coreMigrationVersion: KIBANA_VERSION, + references: [], + namespaces: [SPACE_ID], + }, + ], }); - }); - }); + })); + + it('should not return raw id when object id is unspecified', async () => + await supertest + .post(`/s/${SPACE_ID}/api/saved_objects/_bulk_create`) + .send(BULK_REQUESTS.map(({ id, ...rest }) => rest)) + .expect(200) + .then((resp) => { + resp.body.saved_objects.map(({ id }: { id: string }) => + expect(id).not.match(/visualization|dashboard/) + ); + })); }); } diff --git a/test/api_integration/apis/saved_objects/bulk_get.ts b/test/api_integration/apis/saved_objects/bulk_get.ts index 73765e194f93e2e..81e86913aaf86f9 100644 --- a/test/api_integration/apis/saved_objects/bulk_get.ts +++ b/test/api_integration/apis/saved_objects/bulk_get.ts @@ -12,8 +12,7 @@ import { getKibanaVersion } from './lib/saved_objects_test_utils'; export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const esArchiver = getService('esArchiver'); - const esDeleteAllIndices = getService('esDeleteAllIndices'); + const kibanaServer = getService('kibanaServer'); const BULK_REQUESTS = [ { @@ -35,125 +34,75 @@ export default function ({ getService }: FtrProviderContext) { before(async () => { KIBANA_VERSION = await getKibanaVersion(getService); + await kibanaServer.importExport.load('saved_objects/basic'); }); - describe('with kibana index', () => { - before(() => - esArchiver.load('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); - after(() => - esArchiver.unload('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); + after(() => kibanaServer.importExport.unload('saved_objects/basic')); - it('should return 200 with individual responses', async () => - await supertest - .post(`/api/saved_objects/_bulk_get`) - .send(BULK_REQUESTS) - .expect(200) - .then((resp) => { - expect(resp.body).to.eql({ - saved_objects: [ - { - id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', - type: 'visualization', - updated_at: '2017-09-21T18:51:23.794Z', - version: resp.body.saved_objects[0].version, - attributes: { - title: 'Count of requests', - description: '', - version: 1, - // cheat for some of the more complex attributes - visState: resp.body.saved_objects[0].attributes.visState, - uiStateJSON: resp.body.saved_objects[0].attributes.uiStateJSON, - kibanaSavedObjectMeta: - resp.body.saved_objects[0].attributes.kibanaSavedObjectMeta, - }, - migrationVersion: resp.body.saved_objects[0].migrationVersion, - coreMigrationVersion: KIBANA_VERSION, - namespaces: ['default'], - references: [ - { - name: 'kibanaSavedObjectMeta.searchSourceJSON.index', - type: 'index-pattern', - id: '91200a00-9efd-11e7-acb3-3dab96693fab', - }, - ], - }, - { - id: 'does not exist', - type: 'dashboard', - error: { - error: 'Not Found', - message: 'Saved object [dashboard/does not exist] not found', - statusCode: 404, - }, - }, - { - id: '7.0.0-alpha1', - type: 'config', - updated_at: '2017-09-21T18:49:16.302Z', - version: resp.body.saved_objects[2].version, - attributes: { - buildNum: 8467, - defaultIndex: '91200a00-9efd-11e7-acb3-3dab96693fab', - }, - namespaces: ['default'], - migrationVersion: resp.body.saved_objects[2].migrationVersion, - coreMigrationVersion: KIBANA_VERSION, - references: [], - }, - ], - }); - expect(resp.body.saved_objects[0].migrationVersion).to.be.ok(); - })); - }); - - describe('without kibana index', () => { - before( - async () => - // just in case the kibana server has recreated it - await esDeleteAllIndices('.kibana*') - ); + it('should return 200 with individual responses', async () => + await supertest + .post(`/api/saved_objects/_bulk_get`) + .send(BULK_REQUESTS) + .expect(200) + .then((resp) => { + const mockDate = '2015-01-01T00:00:00.000Z'; + resp.body.saved_objects[0].updated_at = mockDate; + resp.body.saved_objects[2].updated_at = mockDate; - it('should return 200 with individual responses', async () => - await supertest - .post('/api/saved_objects/_bulk_get') - .send(BULK_REQUESTS) - .expect(200) - .then((resp) => { - expect(resp.body).to.eql({ - saved_objects: [ - { - id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', - type: 'visualization', - error: { - error: 'Not Found', - message: - 'Saved object [visualization/dd7caf20-9efd-11e7-acb3-3dab96693fab] not found', - statusCode: 404, - }, + expect(resp.body).to.eql({ + saved_objects: [ + { + id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', + type: 'visualization', + updated_at: '2015-01-01T00:00:00.000Z', + version: resp.body.saved_objects[0].version, + attributes: { + title: 'Count of requests', + description: '', + version: 1, + // cheat for some of the more complex attributes + visState: resp.body.saved_objects[0].attributes.visState, + uiStateJSON: resp.body.saved_objects[0].attributes.uiStateJSON, + kibanaSavedObjectMeta: + resp.body.saved_objects[0].attributes.kibanaSavedObjectMeta, }, - { - id: 'does not exist', - type: 'dashboard', - error: { - error: 'Not Found', - message: 'Saved object [dashboard/does not exist] not found', - statusCode: 404, + migrationVersion: resp.body.saved_objects[0].migrationVersion, + coreMigrationVersion: KIBANA_VERSION, + namespaces: ['default'], + references: [ + { + name: 'kibanaSavedObjectMeta.searchSourceJSON.index', + type: 'index-pattern', + id: '91200a00-9efd-11e7-acb3-3dab96693fab', }, + ], + }, + { + id: 'does not exist', + type: 'dashboard', + error: { + error: 'Not Found', + message: 'Saved object [dashboard/does not exist] not found', + statusCode: 404, }, - { - id: '7.0.0-alpha1', - type: 'config', - error: { - error: 'Not Found', - message: 'Saved object [config/7.0.0-alpha1] not found', - statusCode: 404, - }, + }, + { + id: '7.0.0-alpha1', + type: 'config', + updated_at: '2015-01-01T00:00:00.000Z', + version: resp.body.saved_objects[2].version, + attributes: { + buildNum: 8467, + defaultIndex: '91200a00-9efd-11e7-acb3-3dab96693fab', }, - ], - }); - })); - }); + namespaces: ['default'], + migrationVersion: resp.body.saved_objects[2].migrationVersion, + coreMigrationVersion: KIBANA_VERSION, + references: [], + }, + ], + }); + expect(resp.body.saved_objects[0].migrationVersion).to.be.ok(); + })); }); } diff --git a/test/api_integration/apis/saved_objects/bulk_update.ts b/test/api_integration/apis/saved_objects/bulk_update.ts index c187d879a38fefd..8740652fc395386 100644 --- a/test/api_integration/apis/saved_objects/bulk_update.ts +++ b/test/api_integration/apis/saved_objects/bulk_update.ts @@ -12,243 +12,180 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const esArchiver = getService('esArchiver'); - const esDeleteAllIndices = getService('esDeleteAllIndices'); + const kibanaServer = getService('kibanaServer'); describe('bulkUpdate', () => { - describe('with kibana index', () => { - before(() => - esArchiver.load('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); - after(() => - esArchiver.unload('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); - it('should return 200', async () => { - const response = await supertest - .put(`/api/saved_objects/_bulk_update`) - .send([ - { - type: 'visualization', - id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', - attributes: { - title: 'An existing visualization', - }, - }, - { - type: 'dashboard', - id: 'be3733a0-9efe-11e7-acb3-3dab96693fab', - attributes: { - title: 'An existing dashboard', - }, - }, - ]) - .expect(200); - - const { - saved_objects: [firstObject, secondObject], - } = response.body; - - // loose ISO8601 UTC time with milliseconds validation - expect(firstObject) - .to.have.property('updated_at') - .match(/^[\d-]{10}T[\d:\.]{12}Z$/); - expect(_.omit(firstObject, ['updated_at'])).to.eql({ - id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', - type: 'visualization', - version: firstObject.version, - attributes: { - title: 'An existing visualization', - }, - namespaces: ['default'], - }); - - expect(secondObject) - .to.have.property('updated_at') - .match(/^[\d-]{10}T[\d:\.]{12}Z$/); - expect(_.omit(secondObject, ['updated_at'])).to.eql({ - id: 'be3733a0-9efe-11e7-acb3-3dab96693fab', - type: 'dashboard', - version: secondObject.version, - attributes: { - title: 'An existing dashboard', - }, - namespaces: ['default'], - }); - }); + before(() => kibanaServer.importExport.load('saved_objects/basic')); + after(() => kibanaServer.importExport.unload('saved_objects/basic')); - it('does not pass references if omitted', async () => { - const { - body: { - saved_objects: [visObject, dashObject], - }, - } = await supertest.post(`/api/saved_objects/_bulk_get`).send([ + it('should return 200', async () => { + const response = await supertest + .put(`/api/saved_objects/_bulk_update`) + .send([ { type: 'visualization', id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', + attributes: { + title: 'An existing visualization', + }, }, { type: 'dashboard', id: 'be3733a0-9efe-11e7-acb3-3dab96693fab', + attributes: { + title: 'An existing dashboard', + }, }, - ]); + ]) + .expect(200); + + const { + saved_objects: [firstObject, secondObject], + } = response.body; + + // loose ISO8601 UTC time with milliseconds validation + expect(firstObject) + .to.have.property('updated_at') + .match(/^[\d-]{10}T[\d:\.]{12}Z$/); + expect(_.omit(firstObject, ['updated_at'])).to.eql({ + id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', + type: 'visualization', + version: firstObject.version, + attributes: { + title: 'An existing visualization', + }, + namespaces: ['default'], + }); - const response = await supertest - .put(`/api/saved_objects/_bulk_update`) - .send([ - { - type: 'visualization', - id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', - attributes: { - title: 'Changed title but nothing else', - }, - version: visObject.version, - }, - { - type: 'dashboard', - id: 'be3733a0-9efe-11e7-acb3-3dab96693fab', - attributes: { - title: 'Changed title and references', - }, - version: dashObject.version, - references: [{ id: 'foo', name: 'Foo', type: 'visualization' }], - }, - ]) - .expect(200); + expect(secondObject) + .to.have.property('updated_at') + .match(/^[\d-]{10}T[\d:\.]{12}Z$/); + expect(_.omit(secondObject, ['updated_at'])).to.eql({ + id: 'be3733a0-9efe-11e7-acb3-3dab96693fab', + type: 'dashboard', + version: secondObject.version, + attributes: { + title: 'An existing dashboard', + }, + namespaces: ['default'], + }); + }); - const { - saved_objects: [firstUpdatedObject, secondUpdatedObject], - } = response.body; - expect(firstUpdatedObject).to.not.have.property('error'); - expect(secondUpdatedObject).to.not.have.property('error'); + it('does not pass references if omitted', async () => { + const { + body: { + saved_objects: [visObject, dashObject], + }, + } = await supertest.post(`/api/saved_objects/_bulk_get`).send([ + { + type: 'visualization', + id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', + }, + { + type: 'dashboard', + id: 'be3733a0-9efe-11e7-acb3-3dab96693fab', + }, + ]); - const { - body: { - saved_objects: [visObjectAfterUpdate, dashObjectAfterUpdate], - }, - } = await supertest.post(`/api/saved_objects/_bulk_get`).send([ + const response = await supertest + .put(`/api/saved_objects/_bulk_update`) + .send([ { type: 'visualization', id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', + attributes: { + title: 'Changed title but nothing else', + }, + version: visObject.version, }, { type: 'dashboard', id: 'be3733a0-9efe-11e7-acb3-3dab96693fab', + attributes: { + title: 'Changed title and references', + }, + version: dashObject.version, + references: [{ id: 'foo', name: 'Foo', type: 'visualization' }], }, - ]); - - expect(visObjectAfterUpdate.references).to.eql(visObject.references); - expect(dashObjectAfterUpdate.references).to.eql([ - { id: 'foo', name: 'Foo', type: 'visualization' }, - ]); - }); + ]) + .expect(200); + + const { + saved_objects: [firstUpdatedObject, secondUpdatedObject], + } = response.body; + expect(firstUpdatedObject).to.not.have.property('error'); + expect(secondUpdatedObject).to.not.have.property('error'); + + const { + body: { + saved_objects: [visObjectAfterUpdate, dashObjectAfterUpdate], + }, + } = await supertest.post(`/api/saved_objects/_bulk_get`).send([ + { + type: 'visualization', + id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', + }, + { + type: 'dashboard', + id: 'be3733a0-9efe-11e7-acb3-3dab96693fab', + }, + ]); - it('passes empty references array if empty references array is provided', async () => { - const { - body: { - saved_objects: [{ version }], - }, - } = await supertest.post(`/api/saved_objects/_bulk_get`).send([ - { - type: 'visualization', - id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', - }, - ]); + expect(visObjectAfterUpdate.references).to.eql(visObject.references); + expect(dashObjectAfterUpdate.references).to.eql([ + { id: 'foo', name: 'Foo', type: 'visualization' }, + ]); + }); - await supertest - .put(`/api/saved_objects/_bulk_update`) - .send([ - { - type: 'visualization', - id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', - attributes: { - title: 'Changed title but nothing else', - }, - version, - references: [], - }, - ]) - .expect(200); + it('passes empty references array if empty references array is provided', async () => { + const { + body: { + saved_objects: [{ version }], + }, + } = await supertest.post(`/api/saved_objects/_bulk_get`).send([ + { + type: 'visualization', + id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', + }, + ]); - const { - body: { - saved_objects: [visObjectAfterUpdate], - }, - } = await supertest.post(`/api/saved_objects/_bulk_get`).send([ + await supertest + .put(`/api/saved_objects/_bulk_update`) + .send([ { type: 'visualization', id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', - }, - ]); - - expect(visObjectAfterUpdate.references).to.eql([]); - }); - - describe('unknown id', () => { - it('should return a generic 404', async () => { - const response = await supertest - .put(`/api/saved_objects/_bulk_update`) - .send([ - { - type: 'visualization', - id: 'not an id', - attributes: { - title: 'An existing visualization', - }, - }, - { - type: 'dashboard', - id: 'be3733a0-9efe-11e7-acb3-3dab96693fab', - attributes: { - title: 'An existing dashboard', - }, - }, - ]) - .expect(200); - - const { - saved_objects: [missingObject, updatedObject], - } = response.body; - - // loose ISO8601 UTC time with milliseconds validation - expect(missingObject).eql({ - type: 'visualization', - id: 'not an id', - error: { - statusCode: 404, - error: 'Not Found', - message: 'Saved object [visualization/not an id] not found', - }, - }); - - expect(updatedObject) - .to.have.property('updated_at') - .match(/^[\d-]{10}T[\d:\.]{12}Z$/); - expect(_.omit(updatedObject, ['updated_at', 'version'])).to.eql({ - id: 'be3733a0-9efe-11e7-acb3-3dab96693fab', - type: 'dashboard', attributes: { - title: 'An existing dashboard', + title: 'Changed title but nothing else', }, - namespaces: ['default'], - }); - }); - }); - }); + version, + references: [], + }, + ]) + .expect(200); + + const { + body: { + saved_objects: [visObjectAfterUpdate], + }, + } = await supertest.post(`/api/saved_objects/_bulk_get`).send([ + { + type: 'visualization', + id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', + }, + ]); - describe('without kibana index', () => { - before( - async () => - // just in case the kibana server has recreated it - await esDeleteAllIndices('.kibana*') - ); + expect(visObjectAfterUpdate.references).to.eql([]); + }); - it('should return 200 with errors', async () => { + describe('unknown id', () => { + it('should return a generic 404', async () => { const response = await supertest .put(`/api/saved_objects/_bulk_update`) .send([ { type: 'visualization', - id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', + id: 'not an id', attributes: { title: 'An existing visualization', }, @@ -264,27 +201,30 @@ export default function ({ getService }: FtrProviderContext) { .expect(200); const { - saved_objects: [firstObject, secondObject], + saved_objects: [missingObject, updatedObject], } = response.body; - expect(firstObject).to.eql({ - id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', + // loose ISO8601 UTC time with milliseconds validation + expect(missingObject).eql({ type: 'visualization', + id: 'not an id', error: { - statusCode: 500, - error: 'Internal Server Error', - message: 'An internal server error occurred', + statusCode: 404, + error: 'Not Found', + message: 'Saved object [visualization/not an id] not found', }, }); - expect(secondObject).to.eql({ + expect(updatedObject) + .to.have.property('updated_at') + .match(/^[\d-]{10}T[\d:\.]{12}Z$/); + expect(_.omit(updatedObject, ['updated_at', 'version'])).to.eql({ id: 'be3733a0-9efe-11e7-acb3-3dab96693fab', type: 'dashboard', - error: { - statusCode: 500, - error: 'Internal Server Error', - message: 'An internal server error occurred', + attributes: { + title: 'An existing dashboard', }, + namespaces: ['default'], }); }); }); diff --git a/test/api_integration/apis/saved_objects/create.ts b/test/api_integration/apis/saved_objects/create.ts index 72eb4493e6ef096..dfa7ceb503dfd45 100644 --- a/test/api_integration/apis/saved_objects/create.ts +++ b/test/api_integration/apis/saved_objects/create.ts @@ -12,103 +12,68 @@ import { getKibanaVersion } from './lib/saved_objects_test_utils'; export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const es = getService('es'); - const esArchiver = getService('esArchiver'); - const esDeleteAllIndices = getService('esDeleteAllIndices'); + const kibanaServer = getService('kibanaServer'); describe('create', () => { let KIBANA_VERSION: string; before(async () => { KIBANA_VERSION = await getKibanaVersion(getService); + await kibanaServer.importExport.load('saved_objects/basic'); }); - describe('with kibana index', () => { - before(() => - esArchiver.load('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); - after(() => - esArchiver.unload('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); - it('should return 200', async () => { - await supertest - .post(`/api/saved_objects/visualization`) - .send({ - attributes: { - title: 'My favorite vis', - }, - }) - .expect(200) - .then((resp) => { - // loose uuid validation - expect(resp.body) - .to.have.property('id') - .match(/^[0-9a-f-]{36}$/); + after(() => kibanaServer.importExport.unload('saved_objects/basic')); - // loose ISO8601 UTC time with milliseconds validation - expect(resp.body) - .to.have.property('updated_at') - .match(/^[\d-]{10}T[\d:\.]{12}Z$/); + it('should return 200', async () => { + await supertest + .post(`/api/saved_objects/visualization`) + .send({ + attributes: { + title: 'My favorite vis', + }, + }) + .expect(200) + .then((resp) => { + // loose uuid validation + expect(resp.body) + .to.have.property('id') + .match(/^[0-9a-f-]{36}$/); - expect(resp.body).to.eql({ - id: resp.body.id, - type: 'visualization', - migrationVersion: resp.body.migrationVersion, - coreMigrationVersion: KIBANA_VERSION, - updated_at: resp.body.updated_at, - version: resp.body.version, - attributes: { - title: 'My favorite vis', - }, - references: [], - namespaces: ['default'], - }); - expect(resp.body.migrationVersion).to.be.ok(); - }); - }); + // loose ISO8601 UTC time with milliseconds validation + expect(resp.body) + .to.have.property('updated_at') + .match(/^[\d-]{10}T[\d:\.]{12}Z$/); - it('result should be updated to the latest coreMigrationVersion', async () => { - await supertest - .post(`/api/saved_objects/visualization`) - .send({ + expect(resp.body).to.eql({ + id: resp.body.id, + type: 'visualization', + migrationVersion: resp.body.migrationVersion, + coreMigrationVersion: KIBANA_VERSION, + updated_at: resp.body.updated_at, + version: resp.body.version, attributes: { title: 'My favorite vis', }, - coreMigrationVersion: '1.2.3', - }) - .expect(200) - .then((resp) => { - expect(resp.body.coreMigrationVersion).to.eql(KIBANA_VERSION); + references: [], + namespaces: ['default'], }); - }); + expect(resp.body.migrationVersion).to.be.ok(); + }); }); - describe('without kibana index', () => { - before( - async () => - // just in case the kibana server has recreated it - await esDeleteAllIndices('.kibana*') - ); - - it('should return 500 and not auto-create saved objects index', async () => { - await supertest - .post(`/api/saved_objects/visualization`) - .send({ - attributes: { - title: 'My favorite vis', - }, - }) - .expect(500) - .then((resp) => { - expect(resp.body).to.eql({ - error: 'Internal Server Error', - message: 'An internal server error occurred.', - statusCode: 500, - }); - }); - - expect((await es.indices.exists({ index: '.kibana' })).body).to.be(false); - }); + it('result should be updated to the latest coreMigrationVersion', async () => { + await supertest + .post(`/api/saved_objects/visualization`) + .send({ + attributes: { + title: 'My favorite vis', + }, + coreMigrationVersion: '1.2.3', + }) + .expect(200) + .then((resp) => { + expect(resp.body.coreMigrationVersion).to.eql(KIBANA_VERSION); + }); }); }); } diff --git a/test/api_integration/apis/saved_objects/delete.ts b/test/api_integration/apis/saved_objects/delete.ts index 1145e5405f1224b..9a4525df1b5f75f 100644 --- a/test/api_integration/apis/saved_objects/delete.ts +++ b/test/api_integration/apis/saved_objects/delete.ts @@ -11,57 +11,30 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const esArchiver = getService('esArchiver'); - const esDeleteAllIndices = getService('esDeleteAllIndices'); + const kibanaServer = getService('kibanaServer'); describe('delete', () => { - describe('with kibana index', () => { - before(() => - esArchiver.load('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); - after(() => - esArchiver.unload('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); + before(() => kibanaServer.importExport.load('saved_objects/basic')); + after(() => kibanaServer.importExport.unload('saved_objects/basic')); - it('should return 200 when deleting a doc', async () => - await supertest - .delete(`/api/saved_objects/dashboard/be3733a0-9efe-11e7-acb3-3dab96693fab`) - .expect(200) - .then((resp) => { - expect(resp.body).to.eql({}); - })); + it('should return 200 when deleting a doc', async () => + await supertest + .delete(`/api/saved_objects/dashboard/be3733a0-9efe-11e7-acb3-3dab96693fab`) + .expect(200) + .then((resp) => { + expect(resp.body).to.eql({}); + })); - it('should return generic 404 when deleting an unknown doc', async () => - await supertest - .delete(`/api/saved_objects/dashboard/not-a-real-id`) - .expect(404) - .then((resp) => { - expect(resp.body).to.eql({ - statusCode: 404, - error: 'Not Found', - message: 'Saved object [dashboard/not-a-real-id] not found', - }); - })); - }); - - describe('without kibana index', () => { - before( - async () => - // just in case the kibana server has recreated it - await esDeleteAllIndices('.kibana*') - ); - - it('returns generic 404 when kibana index is missing', async () => - await supertest - .delete(`/api/saved_objects/dashboard/be3733a0-9efe-11e7-acb3-3dab96693fab`) - .expect(404) - .then((resp) => { - expect(resp.body).to.eql({ - statusCode: 404, - error: 'Not Found', - message: 'Saved object [dashboard/be3733a0-9efe-11e7-acb3-3dab96693fab] not found', - }); - })); - }); + it('should return generic 404 when deleting an unknown doc', async () => + await supertest + .delete(`/api/saved_objects/dashboard/not-a-real-id`) + .expect(404) + .then((resp) => { + expect(resp.body).to.eql({ + statusCode: 404, + error: 'Not Found', + message: 'Saved object [dashboard/not-a-real-id] not found', + }); + })); }); } diff --git a/test/api_integration/apis/saved_objects/export.ts b/test/api_integration/apis/saved_objects/export.ts index 000b7f155a743b7..c42afd4e773c539 100644 --- a/test/api_integration/apis/saved_objects/export.ts +++ b/test/api_integration/apis/saved_objects/export.ts @@ -15,581 +15,559 @@ function ndjsonToObject(input: string) { } export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const esArchiver = getService('esArchiver'); - const esDeleteAllIndices = getService('esDeleteAllIndices'); + const kibanaServer = getService('kibanaServer'); + const SPACE_ID = 'ftr-so-export'; describe('export', () => { let KIBANA_VERSION: string; before(async () => { KIBANA_VERSION = await getKibanaVersion(getService); + await kibanaServer.spaces.create({ id: SPACE_ID, name: SPACE_ID }); + await kibanaServer.importExport.load('saved_objects/basic', { space: SPACE_ID }); }); - describe('with kibana index', () => { - describe('basic amount of saved objects', () => { - before(() => - esArchiver.load('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); - after(() => - esArchiver.unload('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); + after(() => kibanaServer.spaces.delete(SPACE_ID)); - it('should return objects in dependency order', async () => { - await supertest - .post('/api/saved_objects/_export') - .send({ - type: ['index-pattern', 'search', 'visualization', 'dashboard'], - }) - .expect(200) - .then((resp) => { - const objects = ndjsonToObject(resp.text); - expect(objects).to.have.length(4); - expect(objects[0]).to.have.property('id', '91200a00-9efd-11e7-acb3-3dab96693fab'); - expect(objects[0]).to.have.property('type', 'index-pattern'); - expect(objects[1]).to.have.property('id', 'dd7caf20-9efd-11e7-acb3-3dab96693fab'); - expect(objects[1]).to.have.property('type', 'visualization'); - expect(objects[2]).to.have.property('id', 'be3733a0-9efe-11e7-acb3-3dab96693fab'); - expect(objects[2]).to.have.property('type', 'dashboard'); - expect(objects[3]).to.have.property('exportedCount', 3); - expect(objects[3]).to.have.property('missingRefCount', 0); - expect(objects[3].missingReferences).to.have.length(0); - }); - }); + describe('basic amount of saved objects', () => { + it('should return objects in dependency order', async () => { + await supertest + .post(`/s/${SPACE_ID}/api/saved_objects/_export`) + .send({ + type: ['index-pattern', 'search', 'visualization', 'dashboard'], + }) + .expect(200) + .then((resp) => { + const objects = ndjsonToObject(resp.text); + expect(objects).to.have.length(4); + expect(objects[0]).to.have.property('id', '91200a00-9efd-11e7-acb3-3dab96693fab'); + expect(objects[0]).to.have.property('type', 'index-pattern'); + expect(objects[1]).to.have.property('id', 'dd7caf20-9efd-11e7-acb3-3dab96693fab'); + expect(objects[1]).to.have.property('type', 'visualization'); + expect(objects[2]).to.have.property('id', 'be3733a0-9efe-11e7-acb3-3dab96693fab'); + expect(objects[2]).to.have.property('type', 'dashboard'); + expect(objects[3]).to.have.property('exportedCount', 3); + expect(objects[3]).to.have.property('missingRefCount', 0); + expect(objects[3].missingReferences).to.have.length(0); + }); + }); - it('should exclude the export details if asked', async () => { - await supertest - .post('/api/saved_objects/_export') - .send({ - type: ['index-pattern', 'search', 'visualization', 'dashboard'], - excludeExportDetails: true, - }) - .expect(200) - .then((resp) => { - const objects = ndjsonToObject(resp.text); - expect(objects).to.have.length(3); - expect(objects[0]).to.have.property('id', '91200a00-9efd-11e7-acb3-3dab96693fab'); - expect(objects[0]).to.have.property('type', 'index-pattern'); - expect(objects[1]).to.have.property('id', 'dd7caf20-9efd-11e7-acb3-3dab96693fab'); - expect(objects[1]).to.have.property('type', 'visualization'); - expect(objects[2]).to.have.property('id', 'be3733a0-9efe-11e7-acb3-3dab96693fab'); - expect(objects[2]).to.have.property('type', 'dashboard'); - }); - }); + it('should exclude the export details if asked', async () => { + await supertest + .post(`/s/${SPACE_ID}/api/saved_objects/_export`) + .send({ + type: ['index-pattern', 'search', 'visualization', 'dashboard'], + excludeExportDetails: true, + }) + .expect(200) + .then((resp) => { + const objects = ndjsonToObject(resp.text); + expect(objects).to.have.length(3); + expect(objects[0]).to.have.property('id', '91200a00-9efd-11e7-acb3-3dab96693fab'); + expect(objects[0]).to.have.property('type', 'index-pattern'); + expect(objects[1]).to.have.property('id', 'dd7caf20-9efd-11e7-acb3-3dab96693fab'); + expect(objects[1]).to.have.property('type', 'visualization'); + expect(objects[2]).to.have.property('id', 'be3733a0-9efe-11e7-acb3-3dab96693fab'); + expect(objects[2]).to.have.property('type', 'dashboard'); + }); + }); - it('should support including dependencies when exporting selected objects', async () => { - await supertest - .post('/api/saved_objects/_export') - .send({ - includeReferencesDeep: true, - objects: [ - { - type: 'dashboard', - id: 'be3733a0-9efe-11e7-acb3-3dab96693fab', - }, - ], - }) - .expect(200) - .then((resp) => { - const objects = ndjsonToObject(resp.text); - expect(objects).to.have.length(4); - expect(objects[0]).to.have.property('id', '91200a00-9efd-11e7-acb3-3dab96693fab'); - expect(objects[0]).to.have.property('type', 'index-pattern'); - expect(objects[1]).to.have.property('id', 'dd7caf20-9efd-11e7-acb3-3dab96693fab'); - expect(objects[1]).to.have.property('type', 'visualization'); - expect(objects[2]).to.have.property('id', 'be3733a0-9efe-11e7-acb3-3dab96693fab'); - expect(objects[2]).to.have.property('type', 'dashboard'); - expect(objects[3]).to.have.property('exportedCount', 3); - expect(objects[3]).to.have.property('missingRefCount', 0); - expect(objects[3].missingReferences).to.have.length(0); - }); - }); + it('should support including dependencies when exporting selected objects', async () => { + await supertest + .post(`/s/${SPACE_ID}/api/saved_objects/_export`) + .send({ + includeReferencesDeep: true, + objects: [ + { + type: 'dashboard', + id: 'be3733a0-9efe-11e7-acb3-3dab96693fab', + }, + ], + }) + .expect(200) + .then((resp) => { + const objects = ndjsonToObject(resp.text); + expect(objects).to.have.length(4); + expect(objects[0]).to.have.property('id', '91200a00-9efd-11e7-acb3-3dab96693fab'); + expect(objects[0]).to.have.property('type', 'index-pattern'); + expect(objects[1]).to.have.property('id', 'dd7caf20-9efd-11e7-acb3-3dab96693fab'); + expect(objects[1]).to.have.property('type', 'visualization'); + expect(objects[2]).to.have.property('id', 'be3733a0-9efe-11e7-acb3-3dab96693fab'); + expect(objects[2]).to.have.property('type', 'dashboard'); + expect(objects[3]).to.have.property('exportedCount', 3); + expect(objects[3]).to.have.property('missingRefCount', 0); + expect(objects[3].missingReferences).to.have.length(0); + }); + }); - it('should support including dependencies when exporting by type', async () => { - await supertest - .post('/api/saved_objects/_export') - .send({ - includeReferencesDeep: true, - type: ['dashboard'], - }) - .expect(200) - .then((resp) => { - const objects = resp.text.split('\n').map((str) => JSON.parse(str)); - expect(objects).to.have.length(4); - expect(objects[0]).to.have.property('id', '91200a00-9efd-11e7-acb3-3dab96693fab'); - expect(objects[0]).to.have.property('type', 'index-pattern'); - expect(objects[1]).to.have.property('id', 'dd7caf20-9efd-11e7-acb3-3dab96693fab'); - expect(objects[1]).to.have.property('type', 'visualization'); - expect(objects[2]).to.have.property('id', 'be3733a0-9efe-11e7-acb3-3dab96693fab'); - expect(objects[2]).to.have.property('type', 'dashboard'); - expect(objects[3]).to.have.property('exportedCount', 3); - expect(objects[3]).to.have.property('missingRefCount', 0); - expect(objects[3].missingReferences).to.have.length(0); - }); - }); + it('should support including dependencies when exporting by type', async () => { + await supertest + .post(`/s/${SPACE_ID}/api/saved_objects/_export`) + .send({ + includeReferencesDeep: true, + type: ['dashboard'], + }) + .expect(200) + .then((resp) => { + const objects = resp.text.split('\n').map((str) => JSON.parse(str)); + expect(objects).to.have.length(4); + expect(objects[0]).to.have.property('id', '91200a00-9efd-11e7-acb3-3dab96693fab'); + expect(objects[0]).to.have.property('type', 'index-pattern'); + expect(objects[1]).to.have.property('id', 'dd7caf20-9efd-11e7-acb3-3dab96693fab'); + expect(objects[1]).to.have.property('type', 'visualization'); + expect(objects[2]).to.have.property('id', 'be3733a0-9efe-11e7-acb3-3dab96693fab'); + expect(objects[2]).to.have.property('type', 'dashboard'); + expect(objects[3]).to.have.property('exportedCount', 3); + expect(objects[3]).to.have.property('missingRefCount', 0); + expect(objects[3].missingReferences).to.have.length(0); + }); + }); - it('should support including dependencies when exporting by type and search', async () => { - await supertest - .post('/api/saved_objects/_export') - .send({ - includeReferencesDeep: true, - type: ['dashboard'], - search: 'Requests*', - }) - .expect(200) - .then((resp) => { - const objects = ndjsonToObject(resp.text); - expect(objects).to.have.length(4); - expect(objects[0]).to.have.property('id', '91200a00-9efd-11e7-acb3-3dab96693fab'); - expect(objects[0]).to.have.property('type', 'index-pattern'); - expect(objects[1]).to.have.property('id', 'dd7caf20-9efd-11e7-acb3-3dab96693fab'); - expect(objects[1]).to.have.property('type', 'visualization'); - expect(objects[2]).to.have.property('id', 'be3733a0-9efe-11e7-acb3-3dab96693fab'); - expect(objects[2]).to.have.property('type', 'dashboard'); - expect(objects[3]).to.have.property('exportedCount', 3); - expect(objects[3]).to.have.property('missingRefCount', 0); - expect(objects[3].missingReferences).to.have.length(0); - }); - }); + it('should support including dependencies when exporting by type and search', async () => { + await supertest + .post(`/s/${SPACE_ID}/api/saved_objects/_export`) + .send({ + includeReferencesDeep: true, + type: ['dashboard'], + search: 'Requests*', + }) + .expect(200) + .then((resp) => { + const objects = ndjsonToObject(resp.text); + expect(objects).to.have.length(4); + expect(objects[0]).to.have.property('id', '91200a00-9efd-11e7-acb3-3dab96693fab'); + expect(objects[0]).to.have.property('type', 'index-pattern'); + expect(objects[1]).to.have.property('id', 'dd7caf20-9efd-11e7-acb3-3dab96693fab'); + expect(objects[1]).to.have.property('type', 'visualization'); + expect(objects[2]).to.have.property('id', 'be3733a0-9efe-11e7-acb3-3dab96693fab'); + expect(objects[2]).to.have.property('type', 'dashboard'); + expect(objects[3]).to.have.property('exportedCount', 3); + expect(objects[3]).to.have.property('missingRefCount', 0); + expect(objects[3].missingReferences).to.have.length(0); + }); + }); - it(`should throw error when object doesn't exist`, async () => { - await supertest - .post('/api/saved_objects/_export') - .send({ - objects: [ - { - type: 'dashboard', - id: '1', - }, - ], - }) - .expect(400) - .then((resp) => { - expect(resp.body).to.eql({ - statusCode: 400, - error: 'Bad Request', - message: 'Error fetching objects to export', - attributes: { - objects: [ - { - id: '1', - type: 'dashboard', - error: { - error: 'Not Found', - message: 'Saved object [dashboard/1] not found', - statusCode: 404, - }, + it(`should throw error when object doesn't exist`, async () => { + await supertest + .post(`/s/${SPACE_ID}/api/saved_objects/_export`) + .send({ + objects: [ + { + type: 'dashboard', + id: '1', + }, + ], + }) + .expect(400) + .then((resp) => { + expect(resp.body).to.eql({ + statusCode: 400, + error: 'Bad Request', + message: 'Error fetching objects to export', + attributes: { + objects: [ + { + id: '1', + type: 'dashboard', + error: { + error: 'Not Found', + message: 'Saved object [dashboard/1] not found', + statusCode: 404, }, - ], - }, - }); + }, + ], + }, }); - }); + }); + }); - it(`should return 400 when exporting unsupported type`, async () => { - await supertest - .post('/api/saved_objects/_export') - .send({ - type: ['wigwags'], - }) - .expect(400) - .then((resp) => { - expect(resp.body).to.eql({ - statusCode: 400, - error: 'Bad Request', - message: 'Trying to export non-exportable type(s): wigwags', - }); + it(`should return 400 when exporting unsupported type`, async () => { + await supertest + .post(`/s/${SPACE_ID}/api/saved_objects/_export`) + .send({ + type: ['wigwags'], + }) + .expect(400) + .then((resp) => { + expect(resp.body).to.eql({ + statusCode: 400, + error: 'Bad Request', + message: 'Trying to export non-exportable type(s): wigwags', }); - }); + }); + }); - it(`should return 400 when exporting objects with unsupported type`, async () => { - await supertest - .post('/api/saved_objects/_export') - .send({ - objects: [ - { - type: 'wigwags', - id: '1', - }, - ], - }) - .expect(400) - .then((resp) => { - expect(resp.body).to.eql({ - statusCode: 400, - error: 'Bad Request', - message: 'Trying to export object(s) with non-exportable types: wigwags:1', - }); + it(`should return 400 when exporting objects with unsupported type`, async () => { + await supertest + .post(`/s/${SPACE_ID}/api/saved_objects/_export`) + .send({ + objects: [ + { + type: 'wigwags', + id: '1', + }, + ], + }) + .expect(400) + .then((resp) => { + expect(resp.body).to.eql({ + statusCode: 400, + error: 'Bad Request', + message: 'Trying to export object(s) with non-exportable types: wigwags:1', }); - }); + }); + }); - it('should export object with circular refs', async () => { - const soWithCycliRefs = [ - { - type: 'dashboard', - id: 'dashboard-a', - attributes: { - title: 'dashboard-a', + it('should export object with circular refs', async () => { + const soWithCycliRefs = [ + { + type: 'dashboard', + id: 'dashboard-a', + attributes: { + title: 'dashboard-a', + }, + references: [ + { + name: 'circular-dashboard-ref', + id: 'dashboard-b', + type: 'dashboard', }, - references: [ - { - name: 'circular-dashboard-ref', - id: 'dashboard-b', - type: 'dashboard', - }, - ], + ], + }, + { + type: 'dashboard', + id: 'dashboard-b', + attributes: { + title: 'dashboard-b', }, - { - type: 'dashboard', - id: 'dashboard-b', + references: [ + { + name: 'circular-dashboard-ref', + id: 'dashboard-a', + type: 'dashboard', + }, + ], + }, + ]; + await supertest + .post(`/s/${SPACE_ID}/api/saved_objects/_bulk_create`) + .send(soWithCycliRefs) + .expect(200); + const resp = await supertest + .post(`/s/${SPACE_ID}/api/saved_objects/_export`) + .send({ + includeReferencesDeep: true, + type: ['dashboard'], + }) + .expect(200); + + const objects = ndjsonToObject(resp.text); + expect(objects.find((o) => o.id === 'dashboard-a')).to.be.ok(); + expect(objects.find((o) => o.id === 'dashboard-b')).to.be.ok(); + }); + }); + + describe('10,000 objects', () => { + before(async () => { + const fileChunks = []; + for (let i = 0; i <= 9995; i++) { + fileChunks.push( + JSON.stringify({ + type: 'visualization', + id: `${SPACE_ID}-${i}`, attributes: { - title: 'dashboard-b', + title: `My visualization (${i})`, + uiStateJSON: '{}', + visState: '{}', }, references: [ { - name: 'circular-dashboard-ref', - id: 'dashboard-a', - type: 'dashboard', + name: 'kibanaSavedObjectMeta.searchSourceJSON.index', + type: 'index-pattern', + id: '91200a00-9efd-11e7-acb3-3dab96693fab', }, ], - }, - ]; - await supertest.post('/api/saved_objects/_bulk_create').send(soWithCycliRefs).expect(200); - const resp = await supertest - .post('/api/saved_objects/_export') - .send({ - includeReferencesDeep: true, - type: ['dashboard'], }) - .expect(200); + ); + } - const objects = ndjsonToObject(resp.text); - expect(objects.find((o) => o.id === 'dashboard-a')).to.be.ok(); - expect(objects.find((o) => o.id === 'dashboard-b')).to.be.ok(); - }); + await supertest + .post(`/s/${SPACE_ID}/api/saved_objects/_import`) + .attach('file', Buffer.from(fileChunks.join('\n'), 'utf8'), 'export.ndjson') + .expect(200); }); - describe('10,000 objects', () => { - before(() => - esArchiver.load('test/api_integration/fixtures/es_archiver/saved_objects/10k') - ); - after(() => - esArchiver.unload('test/api_integration/fixtures/es_archiver/saved_objects/10k') - ); - - it('should return 400 when exporting without type or objects passed in', async () => { - await supertest - .post('/api/saved_objects/_export') - .expect(400) - .then((resp) => { - expect(resp.body).to.eql({ - statusCode: 400, - error: 'Bad Request', - message: '[request body]: expected a plain object value, but found [null] instead.', - }); + it('should return 400 when exporting without type or objects passed in', async () => { + await supertest + .post(`/s/${SPACE_ID}/api/saved_objects/_export`) + .expect(400) + .then((resp) => { + expect(resp.body).to.eql({ + statusCode: 400, + error: 'Bad Request', + message: '[request body]: expected a plain object value, but found [null] instead.', }); - }); - - it('should return 200 when exporting by single type', async () => { - await supertest - .post('/api/saved_objects/_export') - .send({ - type: 'dashboard', - excludeExportDetails: true, - }) - .expect(200) - .then((resp) => { - expect(resp.header['content-disposition']).to.eql( - 'attachment; filename="export.ndjson"' - ); - expect(resp.header['content-type']).to.eql('application/ndjson'); - const objects = ndjsonToObject(resp.text); + }); + }); - // Sort values aren't deterministic so we need to exclude them - const { sort, ...obj } = objects[0]; - expect(obj).to.eql({ - attributes: { - description: '', - hits: 0, - kibanaSavedObjectMeta: { - searchSourceJSON: objects[0].attributes.kibanaSavedObjectMeta.searchSourceJSON, - }, - optionsJSON: objects[0].attributes.optionsJSON, - panelsJSON: objects[0].attributes.panelsJSON, - refreshInterval: { - display: 'Off', - pause: false, - value: 0, - }, - timeFrom: 'Wed Sep 16 2015 22:52:17 GMT-0700', - timeRestore: true, - timeTo: 'Fri Sep 18 2015 12:24:38 GMT-0700', - title: 'Requests', - version: 1, - }, - id: 'be3733a0-9efe-11e7-acb3-3dab96693fab', - migrationVersion: objects[0].migrationVersion, - coreMigrationVersion: KIBANA_VERSION, - references: [ - { - id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', - name: '1:panel_1', - type: 'visualization', - }, - ], - type: 'dashboard', - updated_at: '2017-09-21T18:57:40.826Z', - version: objects[0].version, - }); - expect(objects[0].migrationVersion).to.be.ok(); - expect(() => - JSON.parse(objects[0].attributes.kibanaSavedObjectMeta.searchSourceJSON) - ).not.to.throwError(); - expect(() => JSON.parse(objects[0].attributes.optionsJSON)).not.to.throwError(); - expect(() => JSON.parse(objects[0].attributes.panelsJSON)).not.to.throwError(); - }); - }); + it('should return 200 when exporting by single type', async () => { + await supertest + .post(`/s/${SPACE_ID}/api/saved_objects/_export`) + .send({ + type: 'dashboard', + excludeExportDetails: true, + }) + .expect(200) + .then((resp) => { + expect(resp.header['content-disposition']).to.eql( + 'attachment; filename="export.ndjson"' + ); + expect(resp.header['content-type']).to.eql('application/ndjson'); + const objects = ndjsonToObject(resp.text); - it('should return 200 when exporting by array type', async () => { - await supertest - .post('/api/saved_objects/_export') - .send({ - type: ['dashboard'], - excludeExportDetails: true, - }) - .expect(200) - .then((resp) => { - expect(resp.header['content-disposition']).to.eql( - 'attachment; filename="export.ndjson"' - ); - expect(resp.header['content-type']).to.eql('application/ndjson'); - const objects = ndjsonToObject(resp.text); + // Sort values aren't deterministic so we need to exclude them + const { sort, ...obj } = objects[0]; - // Sort values aren't deterministic so we need to exclude them - const { sort, ...obj } = objects[0]; - expect(obj).to.eql({ - attributes: { - description: '', - hits: 0, - kibanaSavedObjectMeta: { - searchSourceJSON: objects[0].attributes.kibanaSavedObjectMeta.searchSourceJSON, - }, - optionsJSON: objects[0].attributes.optionsJSON, - panelsJSON: objects[0].attributes.panelsJSON, - refreshInterval: { - display: 'Off', - pause: false, - value: 0, - }, - timeFrom: 'Wed Sep 16 2015 22:52:17 GMT-0700', - timeRestore: true, - timeTo: 'Fri Sep 18 2015 12:24:38 GMT-0700', - title: 'Requests', - version: 1, + expect(obj).to.eql({ + attributes: { + description: '', + hits: 0, + kibanaSavedObjectMeta: { + searchSourceJSON: objects[0].attributes.kibanaSavedObjectMeta.searchSourceJSON, }, - id: 'be3733a0-9efe-11e7-acb3-3dab96693fab', - migrationVersion: objects[0].migrationVersion, - coreMigrationVersion: KIBANA_VERSION, - references: [ - { - id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', - name: '1:panel_1', - type: 'visualization', - }, - ], - type: 'dashboard', - updated_at: '2017-09-21T18:57:40.826Z', - version: objects[0].version, - }); - expect(objects[0].migrationVersion).to.be.ok(); - expect(() => - JSON.parse(objects[0].attributes.kibanaSavedObjectMeta.searchSourceJSON) - ).not.to.throwError(); - expect(() => JSON.parse(objects[0].attributes.optionsJSON)).not.to.throwError(); - expect(() => JSON.parse(objects[0].attributes.panelsJSON)).not.to.throwError(); - }); - }); - - it('should return 200 when exporting by objects', async () => { - await supertest - .post('/api/saved_objects/_export') - .send({ - objects: [ + optionsJSON: objects[0].attributes.optionsJSON, + panelsJSON: objects[0].attributes.panelsJSON, + refreshInterval: { + display: 'Off', + pause: false, + value: 0, + }, + timeFrom: 'Wed Sep 16 2015 22:52:17 GMT-0700', + timeRestore: true, + timeTo: 'Fri Sep 18 2015 12:24:38 GMT-0700', + title: 'Requests', + version: 1, + }, + id: 'be3733a0-9efe-11e7-acb3-3dab96693fab', + migrationVersion: objects[0].migrationVersion, + coreMigrationVersion: KIBANA_VERSION, + references: [ { - type: 'dashboard', - id: 'be3733a0-9efe-11e7-acb3-3dab96693fab', + id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', + name: '1:panel_1', + type: 'visualization', }, ], - excludeExportDetails: true, - }) - .expect(200) - .then((resp) => { - expect(resp.header['content-disposition']).to.eql( - 'attachment; filename="export.ndjson"' - ); - expect(resp.header['content-type']).to.eql('application/ndjson'); - const objects = ndjsonToObject(resp.text); - - // Sort values aren't deterministic so we need to exclude them - const { sort, ...obj } = objects[0]; - expect(obj).to.eql({ - attributes: { - description: '', - hits: 0, - kibanaSavedObjectMeta: { - searchSourceJSON: objects[0].attributes.kibanaSavedObjectMeta.searchSourceJSON, - }, - optionsJSON: objects[0].attributes.optionsJSON, - panelsJSON: objects[0].attributes.panelsJSON, - refreshInterval: { - display: 'Off', - pause: false, - value: 0, - }, - timeFrom: 'Wed Sep 16 2015 22:52:17 GMT-0700', - timeRestore: true, - timeTo: 'Fri Sep 18 2015 12:24:38 GMT-0700', - title: 'Requests', - version: 1, - }, - id: 'be3733a0-9efe-11e7-acb3-3dab96693fab', - migrationVersion: objects[0].migrationVersion, - coreMigrationVersion: KIBANA_VERSION, - references: [ - { - id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', - name: '1:panel_1', - type: 'visualization', - }, - ], - type: 'dashboard', - updated_at: '2017-09-21T18:57:40.826Z', - version: objects[0].version, - }); - expect(objects[0].migrationVersion).to.be.ok(); - expect(() => - JSON.parse(objects[0].attributes.kibanaSavedObjectMeta.searchSourceJSON) - ).not.to.throwError(); - expect(() => JSON.parse(objects[0].attributes.optionsJSON)).not.to.throwError(); - expect(() => JSON.parse(objects[0].attributes.panelsJSON)).not.to.throwError(); + type: 'dashboard', + updated_at: objects[0].updated_at, + version: objects[0].version, }); - }); + expect(objects[0].migrationVersion).to.be.ok(); + expect(() => + JSON.parse(objects[0].attributes.kibanaSavedObjectMeta.searchSourceJSON) + ).not.to.throwError(); + expect(() => JSON.parse(objects[0].attributes.optionsJSON)).not.to.throwError(); + expect(() => JSON.parse(objects[0].attributes.panelsJSON)).not.to.throwError(); + }); + }); - it('should return 400 when exporting by type and objects', async () => { - await supertest - .post('/api/saved_objects/_export') - .send({ - type: 'dashboard', - objects: [ + it('should return 200 when exporting by array type', async () => { + await supertest + .post(`/s/${SPACE_ID}/api/saved_objects/_export`) + .send({ + type: ['dashboard'], + excludeExportDetails: true, + }) + .expect(200) + .then((resp) => { + expect(resp.header['content-disposition']).to.eql( + 'attachment; filename="export.ndjson"' + ); + expect(resp.header['content-type']).to.eql('application/ndjson'); + const objects = ndjsonToObject(resp.text); + + // Sort values aren't deterministic so we need to exclude them + const { sort, ...obj } = objects[0]; + expect(obj).to.eql({ + attributes: { + description: '', + hits: 0, + kibanaSavedObjectMeta: { + searchSourceJSON: objects[0].attributes.kibanaSavedObjectMeta.searchSourceJSON, + }, + optionsJSON: objects[0].attributes.optionsJSON, + panelsJSON: objects[0].attributes.panelsJSON, + refreshInterval: { + display: 'Off', + pause: false, + value: 0, + }, + timeFrom: 'Wed Sep 16 2015 22:52:17 GMT-0700', + timeRestore: true, + timeTo: 'Fri Sep 18 2015 12:24:38 GMT-0700', + title: 'Requests', + version: 1, + }, + id: 'be3733a0-9efe-11e7-acb3-3dab96693fab', + migrationVersion: objects[0].migrationVersion, + coreMigrationVersion: KIBANA_VERSION, + references: [ { - type: 'dashboard', - id: 'be3733a0-9efe-11e7-acb3-3dab96693fab', + id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', + name: '1:panel_1', + type: 'visualization', }, ], - excludeExportDetails: true, - }) - .expect(400) - .then((resp) => { - expect(resp.body).to.eql({ - statusCode: 400, - error: 'Bad Request', - message: `Can't specify both "types" and "objects" properties when exporting`, - }); + type: 'dashboard', + updated_at: objects[0].updated_at, + version: objects[0].version, }); - }); + expect(objects[0].migrationVersion).to.be.ok(); + expect(() => + JSON.parse(objects[0].attributes.kibanaSavedObjectMeta.searchSourceJSON) + ).not.to.throwError(); + expect(() => JSON.parse(objects[0].attributes.optionsJSON)).not.to.throwError(); + expect(() => JSON.parse(objects[0].attributes.panelsJSON)).not.to.throwError(); + }); }); - describe('10,001 objects', () => { - let customVisId: string; - before(async () => { - await esArchiver.load('test/api_integration/fixtures/es_archiver/saved_objects/10k'); - await supertest - .post('/api/saved_objects/visualization') - .send({ - attributes: { - title: 'My favorite vis', + it('should return 200 when exporting by objects', async () => { + await supertest + .post(`/s/${SPACE_ID}/api/saved_objects/_export`) + .send({ + objects: [ + { + type: 'dashboard', + id: 'be3733a0-9efe-11e7-acb3-3dab96693fab', }, - }) - .expect(200) - .then((resp) => { - customVisId = resp.body.id; - }); - }); - after(async () => { - await supertest.delete(`/api/saved_objects/visualization/${customVisId}`).expect(200); - await esArchiver.unload('test/api_integration/fixtures/es_archiver/saved_objects/10k'); - }); - - it('should allow exporting more than 10,000 objects if permitted by maxImportExportSize', async () => { - await supertest - .post('/api/saved_objects/_export') - .send({ - type: ['dashboard', 'visualization', 'search', 'index-pattern'], - excludeExportDetails: true, - }) - .expect(200) - .then((resp) => { - expect(resp.header['content-disposition']).to.eql( - 'attachment; filename="export.ndjson"' - ); - expect(resp.header['content-type']).to.eql('application/ndjson'); - const objects = ndjsonToObject(resp.text); - expect(objects.length).to.eql(10001); - }); - }); + ], + excludeExportDetails: true, + }) + .expect(200) + .then((resp) => { + expect(resp.header['content-disposition']).to.eql( + 'attachment; filename="export.ndjson"' + ); + expect(resp.header['content-type']).to.eql('application/ndjson'); + const objects = ndjsonToObject(resp.text); - it('should return 400 when exporting more than allowed by maxImportExportSize', async () => { - let anotherCustomVisId: string; - await supertest - .post('/api/saved_objects/visualization') - .send({ + // Sort values aren't deterministic so we need to exclude them + const { sort, ...obj } = objects[0]; + expect(obj).to.eql({ attributes: { - title: 'My other favorite vis', + description: '', + hits: 0, + kibanaSavedObjectMeta: { + searchSourceJSON: objects[0].attributes.kibanaSavedObjectMeta.searchSourceJSON, + }, + optionsJSON: objects[0].attributes.optionsJSON, + panelsJSON: objects[0].attributes.panelsJSON, + refreshInterval: { + display: 'Off', + pause: false, + value: 0, + }, + timeFrom: 'Wed Sep 16 2015 22:52:17 GMT-0700', + timeRestore: true, + timeTo: 'Fri Sep 18 2015 12:24:38 GMT-0700', + title: 'Requests', + version: 1, }, - }) - .expect(200) - .then((resp) => { - anotherCustomVisId = resp.body.id; - }); - await supertest - .post('/api/saved_objects/_export') - .send({ - type: ['dashboard', 'visualization', 'search', 'index-pattern'], - excludeExportDetails: true, - }) - .expect(400) - .then((resp) => { - expect(resp.body).to.eql({ - statusCode: 400, - error: 'Bad Request', - message: `Can't export more than 10001 objects. If your server has enough memory, this limit can be increased by adjusting the \"savedObjects.maxImportExportSize\" setting.`, - }); + id: 'be3733a0-9efe-11e7-acb3-3dab96693fab', + migrationVersion: objects[0].migrationVersion, + coreMigrationVersion: KIBANA_VERSION, + references: [ + { + id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', + name: '1:panel_1', + type: 'visualization', + }, + ], + type: 'dashboard', + updated_at: objects[0].updated_at, + version: objects[0].version, }); - await supertest - // @ts-expect-error TS complains about using `anotherCustomVisId` before it is assigned - .delete(`/api/saved_objects/visualization/${anotherCustomVisId}`) - .expect(200); - }); + expect(objects[0].migrationVersion).to.be.ok(); + expect(() => + JSON.parse(objects[0].attributes.kibanaSavedObjectMeta.searchSourceJSON) + ).not.to.throwError(); + expect(() => JSON.parse(objects[0].attributes.optionsJSON)).not.to.throwError(); + expect(() => JSON.parse(objects[0].attributes.panelsJSON)).not.to.throwError(); + }); }); - }); - describe('without kibana index', () => { - before( - async () => - // just in case the kibana server has recreated it - await esDeleteAllIndices('.kibana*') - ); + it('should return 400 when exporting by type and objects', async () => { + await supertest + .post(`/s/${SPACE_ID}/api/saved_objects/_export`) + .send({ + type: 'dashboard', + objects: [ + { + type: 'dashboard', + id: 'be3733a0-9efe-11e7-acb3-3dab96693fab', + }, + ], + excludeExportDetails: true, + }) + .expect(400) + .then((resp) => { + expect(resp.body).to.eql({ + statusCode: 400, + error: 'Bad Request', + message: `Can't specify both "types" and "objects" properties when exporting`, + }); + }); + }); - it('should return empty response', async () => { + it('should allow exporting more than 10,000 objects if permitted by maxImportExportSize', async () => { await supertest - .post('/api/saved_objects/_export') + .post(`/s/${SPACE_ID}/api/saved_objects/_export`) .send({ - type: ['index-pattern', 'search', 'visualization', 'dashboard'], + type: ['dashboard', 'visualization', 'search', 'index-pattern'], excludeExportDetails: true, }) .expect(200) .then((resp) => { - expect(resp.text).to.eql(''); + expect(resp.header['content-disposition']).to.eql( + 'attachment; filename="export.ndjson"' + ); + expect(resp.header['content-type']).to.eql('application/ndjson'); + const objects = ndjsonToObject(resp.text); + expect(objects.length).to.eql(10001); + }); + }); + + it('should return 400 when exporting more than allowed by maxImportExportSize', async () => { + let anotherCustomVisId: string; + await supertest + .post(`/s/${SPACE_ID}/api/saved_objects/visualization`) + .send({ + attributes: { + title: 'My other favorite vis', + }, + }) + .expect(200) + .then((resp) => { + anotherCustomVisId = resp.body.id; + }); + await supertest + .post(`/s/${SPACE_ID}/api/saved_objects/_export`) + .send({ + type: ['dashboard', 'visualization', 'search', 'index-pattern'], + excludeExportDetails: true, + }) + .expect(400) + .then((resp) => { + expect(resp.body).to.eql({ + statusCode: 400, + error: 'Bad Request', + message: `Can't export more than 10001 objects. If your server has enough memory, this limit can be increased by adjusting the \"savedObjects.maxImportExportSize\" setting.`, + }); }); + await supertest + // @ts-expect-error TS complains about using `anotherCustomVisId` before it is assigned + .delete(`/s/${SPACE_ID}/api/saved_objects/visualization/${anotherCustomVisId}`) + .expect(200); }); }); }); diff --git a/test/api_integration/apis/saved_objects/find.ts b/test/api_integration/apis/saved_objects/find.ts index 5f4c6e696b6cf50..02fa2d325f17138 100644 --- a/test/api_integration/apis/saved_objects/find.ts +++ b/test/api_integration/apis/saved_objects/find.ts @@ -12,315 +12,323 @@ import { SavedObject } from '../../../../src/core/server'; export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const esArchiver = getService('esArchiver'); - const esDeleteAllIndices = getService('esDeleteAllIndices'); + const kibanaServer = getService('kibanaServer'); + const SPACE_ID = 'ftr-so-find'; describe('find', () => { - describe('with kibana index', () => { - before(() => - esArchiver.load('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); - after(() => - esArchiver.unload('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); + before(async () => { + await kibanaServer.spaces.create({ id: SPACE_ID, name: SPACE_ID }); + await kibanaServer.importExport.load('saved_objects/basic', { space: SPACE_ID }); - it('should return 200 with individual responses', async () => + await kibanaServer.spaces.create({ id: `${SPACE_ID}-foo`, name: `${SPACE_ID}-foo` }); + await kibanaServer.importExport.load('saved_objects/basic/foo-ns', { + space: `${SPACE_ID}-foo`, + }); + }); + + after(async () => { + await kibanaServer.spaces.delete(SPACE_ID); + await kibanaServer.spaces.delete(`${SPACE_ID}-foo`); + }); + + it('should return 200 with individual responses', async () => + await supertest + .get(`/s/${SPACE_ID}/api/saved_objects/_find?type=visualization&fields=title`) + .expect(200) + .then((resp) => { + expect(resp.body.saved_objects.map((so: { id: string }) => so.id)).to.eql([ + 'dd7caf20-9efd-11e7-acb3-3dab96693fab', + ]); + expect(resp.body.saved_objects[0].migrationVersion).to.be.ok(); + })); + + describe('unknown type', () => { + it('should return 200 with empty response', async () => await supertest - .get('/api/saved_objects/_find?type=visualization&fields=title') + .get(`/s/${SPACE_ID}/api/saved_objects/_find?type=wigwags`) .expect(200) .then((resp) => { - expect(resp.body.saved_objects.map((so: { id: string }) => so.id)).to.eql([ - 'dd7caf20-9efd-11e7-acb3-3dab96693fab', - ]); - expect(resp.body.saved_objects[0].migrationVersion).to.be.ok(); + expect(resp.body).to.eql({ + page: 1, + per_page: 20, + total: 0, + saved_objects: [], + }); })); + }); - describe('unknown type', () => { - it('should return 200 with empty response', async () => - await supertest - .get('/api/saved_objects/_find?type=wigwags') - .expect(200) - .then((resp) => { - expect(resp.body).to.eql({ - page: 1, - per_page: 20, - total: 0, - saved_objects: [], - }); - })); - }); + // FLAKY: https://github.com/elastic/kibana/issues/85911 + describe.skip('page beyond total', () => { + it('should return 200 with empty response', async () => + await supertest + .get(`/s/${SPACE_ID}/api/saved_objects/_find?type=visualization&page=100&per_page=100`) + .expect(200) + .then((resp) => { + expect(resp.body).to.eql({ + page: 100, + per_page: 100, + total: 1, + saved_objects: [], + }); + })); + }); - // FLAKY: https://github.com/elastic/kibana/issues/85911 - describe.skip('page beyond total', () => { - it('should return 200 with empty response', async () => - await supertest - .get('/api/saved_objects/_find?type=visualization&page=100&per_page=100') - .expect(200) - .then((resp) => { - expect(resp.body).to.eql({ - page: 100, - per_page: 100, - total: 1, - saved_objects: [], - }); - })); - }); + describe('unknown search field', () => { + it('should return 200 with empty response', async () => + await supertest + .get(`/s/${SPACE_ID}/api/saved_objects/_find?type=url&search_fields=a`) + .expect(200) + .then((resp) => { + expect(resp.body).to.eql({ + page: 1, + per_page: 20, + total: 0, + saved_objects: [], + }); + })); + }); - describe('unknown search field', () => { - it('should return 200 with empty response', async () => - await supertest - .get('/api/saved_objects/_find?type=url&search_fields=a') - .expect(200) - .then((resp) => { - expect(resp.body).to.eql({ - page: 1, - per_page: 20, - total: 0, - saved_objects: [], - }); - })); - }); + describe('unknown namespace', () => { + it('should return 200 with empty response', async () => + await supertest + .get(`/s/${SPACE_ID}/api/saved_objects/_find?type=visualization&namespaces=foo`) + .expect(200) + .then((resp) => { + expect(resp.body).to.eql({ + page: 1, + per_page: 20, + total: 0, + saved_objects: [], + }); + })); + }); - describe('unknown namespace', () => { - it('should return 200 with empty response', async () => - await supertest - .get('/api/saved_objects/_find?type=visualization&namespaces=foo') - .expect(200) - .then((resp) => { - expect(resp.body).to.eql({ - page: 1, - per_page: 20, - total: 0, - saved_objects: [], - }); - })); - }); + describe('known namespace', () => { + it('should return 200 with individual responses', async () => + await supertest + .get(`/api/saved_objects/_find?type=visualization&fields=title&namespaces=${SPACE_ID}`) + .expect(200) + .then((resp) => { + expect( + resp.body.saved_objects.map((so: { id: string; namespaces: string[] }) => ({ + id: so.id, + namespaces: so.namespaces, + })) + ).to.eql([{ id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', namespaces: [SPACE_ID] }]); + expect(resp.body.saved_objects[0].migrationVersion).to.be.ok(); + })); + }); - describe('known namespace', () => { - it('should return 200 with individual responses', async () => - await supertest - .get('/api/saved_objects/_find?type=visualization&fields=title&namespaces=default') - .expect(200) - .then((resp) => { - expect( - resp.body.saved_objects.map((so: { id: string; namespaces: string[] }) => ({ - id: so.id, - namespaces: so.namespaces, - })) - ).to.eql([{ id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', namespaces: ['default'] }]); - expect(resp.body.saved_objects[0].migrationVersion).to.be.ok(); - })); - }); + describe('wildcard namespace', () => { + it('should return 200 with individual responses from the all namespaces', async () => + await supertest + .get(`/api/saved_objects/_find?type=visualization&fields=title&namespaces=*`) + .expect(200) + .then((resp) => { + const knownDocuments = resp.body.saved_objects.filter((so: { namespaces: string[] }) => + so.namespaces.some((ns) => [SPACE_ID, `${SPACE_ID}-foo`].includes(ns)) + ); - describe('wildcard namespace', () => { - it('should return 200 with individual responses from the all namespaces', async () => - await supertest - .get('/api/saved_objects/_find?type=visualization&fields=title&namespaces=*') - .expect(200) - .then((resp) => { - expect( - resp.body.saved_objects.map((so: { id: string; namespaces: string[] }) => ({ - id: so.id, - namespaces: so.namespaces, - })) - ).to.eql([ - { id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', namespaces: ['default'] }, - { id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', namespaces: ['foo-ns'] }, - ]); - })); - }); + expect( + knownDocuments.map((so: { id: string; namespaces: string[] }) => ({ + id: so.id, + namespaces: so.namespaces, + })) + ).to.eql([ + { id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', namespaces: [SPACE_ID] }, + { id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', namespaces: [`${SPACE_ID}-foo`] }, + ]); + })); + }); - describe('with a filter', () => { - it('should return 200 with a valid response', async () => - await supertest - .get( - '/api/saved_objects/_find?type=visualization&filter=visualization.attributes.title:"Count of requests"' - ) - .expect(200) - .then((resp) => { - expect(resp.body.saved_objects.map((so: { id: string }) => so.id)).to.eql([ - 'dd7caf20-9efd-11e7-acb3-3dab96693fab', - ]); - })); + describe('with a filter', () => { + it('should return 200 with a valid response', async () => + await supertest + .get( + `/s/${SPACE_ID}/api/saved_objects/_find?type=visualization&filter=visualization.attributes.title:"Count of requests"` + ) + .expect(200) + .then((resp) => { + expect(resp.body.saved_objects.map((so: { id: string }) => so.id)).to.eql([ + 'dd7caf20-9efd-11e7-acb3-3dab96693fab', + ]); + })); - it('wrong type should return 400 with Bad Request', async () => - await supertest - .get( - '/api/saved_objects/_find?type=visualization&filter=dashboard.attributes.title:foo' - ) - .expect(400) - .then((resp) => { - expect(resp.body).to.eql({ - error: 'Bad Request', - message: 'This type dashboard is not allowed: Bad Request', - statusCode: 400, - }); - })); + it('wrong type should return 400 with Bad Request', async () => + await supertest + .get( + `/s/${SPACE_ID}/api/saved_objects/_find?type=visualization&filter=dashboard.attributes.title:foo` + ) + .expect(400) + .then((resp) => { + expect(resp.body).to.eql({ + error: 'Bad Request', + message: 'This type dashboard is not allowed: Bad Request', + statusCode: 400, + }); + })); - it('KQL syntax error should return 400 with Bad Request', async () => - await supertest - .get( - '/api/saved_objects/_find?type=dashboard&filter=dashboard.attributes.title:foo { - expect(resp.body).to.eql({ - error: 'Bad Request', - message: - 'KQLSyntaxError: Expected AND, OR, end of input but "<" found.\ndashboard.' + - 'attributes.title:foo + await supertest + .get( + `/s/${SPACE_ID}/api/saved_objects/_find?type=dashboard&filter=dashboard.attributes.title:foo { + expect(resp.body).to.eql({ + error: 'Bad Request', + message: + 'KQLSyntaxError: Expected AND, OR, end of input but "<" found.\ndashboard.' + + 'attributes.title:foo { - it('should return 200 with valid response for a valid aggregation', async () => - await supertest - .get( - `/api/saved_objects/_find?type=visualization&per_page=0&aggs=${encodeURIComponent( - JSON.stringify({ - type_count: { max: { field: 'visualization.attributes.version' } }, - }) - )}` - ) - .expect(200) - .then((resp) => { - expect(resp.body).to.eql({ - aggregations: { - type_count: { - value: 1, - }, + describe('using aggregations', () => { + it('should return 200 with valid response for a valid aggregation', async () => + await supertest + .get( + `/s/${SPACE_ID}/api/saved_objects/_find?type=visualization&per_page=0&aggs=${encodeURIComponent( + JSON.stringify({ + type_count: { max: { field: 'visualization.attributes.version' } }, + }) + )}` + ) + .expect(200) + .then((resp) => { + expect(resp.body).to.eql({ + aggregations: { + type_count: { + value: 1, }, - page: 1, - per_page: 0, - saved_objects: [], - total: 1, - }); - })); + }, + page: 1, + per_page: 0, + saved_objects: [], + total: 1, + }); + })); - it('should return a 400 when referencing an invalid SO attribute', async () => - await supertest - .get( - `/api/saved_objects/_find?type=visualization&per_page=0&aggs=${encodeURIComponent( - JSON.stringify({ - type_count: { max: { field: 'dashboard.attributes.version' } }, - }) - )}` - ) - .expect(400) - .then((resp) => { - expect(resp.body).to.eql({ - error: 'Bad Request', - message: - 'Invalid aggregation: [type_count.max.field] Invalid attribute path: dashboard.attributes.version: Bad Request', - statusCode: 400, - }); - })); + it('should return a 400 when referencing an invalid SO attribute', async () => + await supertest + .get( + `/s/${SPACE_ID}/api/saved_objects/_find?type=visualization&per_page=0&aggs=${encodeURIComponent( + JSON.stringify({ + type_count: { max: { field: 'dashboard.attributes.version' } }, + }) + )}` + ) + .expect(400) + .then((resp) => { + expect(resp.body).to.eql({ + error: 'Bad Request', + message: + 'Invalid aggregation: [type_count.max.field] Invalid attribute path: dashboard.attributes.version: Bad Request', + statusCode: 400, + }); + })); - it('should return a 400 when using a forbidden aggregation option', async () => - await supertest - .get( - `/api/saved_objects/_find?type=visualization&per_page=0&aggs=${encodeURIComponent( - JSON.stringify({ - type_count: { - max: { - field: 'visualization.attributes.version', - script: 'Bad script is bad', - }, + it('should return a 400 when using a forbidden aggregation option', async () => + await supertest + .get( + `/s/${SPACE_ID}/api/saved_objects/_find?type=visualization&per_page=0&aggs=${encodeURIComponent( + JSON.stringify({ + type_count: { + max: { + field: 'visualization.attributes.version', + script: 'Bad script is bad', }, - }) - )}` - ) - .expect(400) - .then((resp) => { - expect(resp.body).to.eql({ - error: 'Bad Request', - message: - 'Invalid aggregation: [type_count.max.script]: definition for this key is missing: Bad Request', - statusCode: 400, - }); - })); - }); + }, + }) + )}` + ) + .expect(400) + .then((resp) => { + expect(resp.body).to.eql({ + error: 'Bad Request', + message: + 'Invalid aggregation: [type_count.max.script]: definition for this key is missing: Bad Request', + statusCode: 400, + }); + })); + }); - describe('`has_reference` and `has_reference_operator` parameters', () => { - before(() => - esArchiver.load('test/api_integration/fixtures/es_archiver/saved_objects/references') - ); - after(() => - esArchiver.unload('test/api_integration/fixtures/es_archiver/saved_objects/references') - ); + describe('`has_reference` and `has_reference_operator` parameters', () => { + before(() => kibanaServer.importExport.load('saved_objects/references', { space: SPACE_ID })); + after(() => + kibanaServer.importExport.unload('saved_objects/references', { space: SPACE_ID }) + ); - it('search for a reference', async () => { - await supertest - .get('/api/saved_objects/_find') - .query({ - type: 'visualization', - has_reference: JSON.stringify({ type: 'ref-type', id: 'ref-1' }), - }) - .expect(200) - .then((resp) => { - const objects = resp.body.saved_objects; - expect(objects.map((obj: SavedObject) => obj.id)).to.eql([ - 'only-ref-1', - 'ref-1-and-ref-2', - ]); - }); - }); + it('search for a reference', async () => { + await supertest + .get(`/s/${SPACE_ID}/api/saved_objects/_find`) + .query({ + type: 'visualization', + has_reference: JSON.stringify({ type: 'ref-type', id: 'ref-1' }), + }) + .expect(200) + .then((resp) => { + const objects = resp.body.saved_objects; + expect(objects.map((obj: SavedObject) => obj.id)).to.eql([ + 'only-ref-1', + 'ref-1-and-ref-2', + ]); + }); + }); - it('search for multiple references with OR operator', async () => { - await supertest - .get('/api/saved_objects/_find') - .query({ - type: 'visualization', - has_reference: JSON.stringify([ - { type: 'ref-type', id: 'ref-1' }, - { type: 'ref-type', id: 'ref-2' }, - ]), - has_reference_operator: 'OR', - }) - .expect(200) - .then((resp) => { - const objects = resp.body.saved_objects; - expect(objects.map((obj: SavedObject) => obj.id)).to.eql([ - 'only-ref-1', - 'ref-1-and-ref-2', - 'only-ref-2', - ]); - }); - }); + it('search for multiple references with OR operator', async () => { + await supertest + .get(`/s/${SPACE_ID}/api/saved_objects/_find`) + .query({ + type: 'visualization', + has_reference: JSON.stringify([ + { type: 'ref-type', id: 'ref-1' }, + { type: 'ref-type', id: 'ref-2' }, + ]), + has_reference_operator: 'OR', + }) + .expect(200) + .then((resp) => { + const objects = resp.body.saved_objects; + expect(objects.map((obj: SavedObject) => obj.id)).to.eql([ + 'only-ref-1', + 'only-ref-2', + 'ref-1-and-ref-2', + ]); + }); + }); - it('search for multiple references with AND operator', async () => { - await supertest - .get('/api/saved_objects/_find') - .query({ - type: 'visualization', - has_reference: JSON.stringify([ - { type: 'ref-type', id: 'ref-1' }, - { type: 'ref-type', id: 'ref-2' }, - ]), - has_reference_operator: 'AND', - }) - .expect(200) - .then((resp) => { - const objects = resp.body.saved_objects; - expect(objects.map((obj: SavedObject) => obj.id)).to.eql(['ref-1-and-ref-2']); - }); - }); + it('search for multiple references with AND operator', async () => { + await supertest + .get(`/s/${SPACE_ID}/api/saved_objects/_find`) + .query({ + type: 'visualization', + has_reference: JSON.stringify([ + { type: 'ref-type', id: 'ref-1' }, + { type: 'ref-type', id: 'ref-2' }, + ]), + has_reference_operator: 'AND', + }) + .expect(200) + .then((resp) => { + const objects = resp.body.saved_objects; + expect(objects.map((obj: SavedObject) => obj.id)).to.eql(['ref-1-and-ref-2']); + }); }); }); describe('searching for special characters', () => { before(() => - esArchiver.load('test/api_integration/fixtures/es_archiver/saved_objects/find_edgecases') + kibanaServer.importExport.load('saved_objects/find_edgecases', { space: SPACE_ID }) ); after(() => - esArchiver.unload('test/api_integration/fixtures/es_archiver/saved_objects/find_edgecases') + kibanaServer.importExport.unload('saved_objects/find_edgecases', { space: SPACE_ID }) ); it('can search for objects with dashes', async () => await supertest - .get('/api/saved_objects/_find') + .get(`/s/${SPACE_ID}/api/saved_objects/_find`) .query({ type: 'visualization', search_fields: 'title', @@ -336,7 +344,7 @@ export default function ({ getService }: FtrProviderContext) { it('can search with the prefix search character just after a special one', async () => await supertest - .get('/api/saved_objects/_find') + .get(`/s/${SPACE_ID}/api/saved_objects/_find`) .query({ type: 'visualization', search_fields: 'title', @@ -352,7 +360,7 @@ export default function ({ getService }: FtrProviderContext) { it('can search for objects with asterisk', async () => await supertest - .get('/api/saved_objects/_find') + .get(`/s/${SPACE_ID}/api/saved_objects/_find`) .query({ type: 'visualization', search_fields: 'title', @@ -368,7 +376,7 @@ export default function ({ getService }: FtrProviderContext) { it('can still search tokens by prefix', async () => await supertest - .get('/api/saved_objects/_find') + .get(`/s/${SPACE_ID}/api/saved_objects/_find`) .query({ type: 'visualization', search_fields: 'title', @@ -379,120 +387,8 @@ export default function ({ getService }: FtrProviderContext) { const savedObjects = resp.body.saved_objects; expect( savedObjects.map((so: SavedObject<{ title: string }>) => so.attributes.title) - ).to.eql(['my-visualization', 'some*visualization']); - })); - }); - - describe('without kibana index', () => { - before( - async () => - // just in case the kibana server has recreated it - await esDeleteAllIndices('.kibana*') - ); - - it('should return 200 with empty response', async () => - await supertest - .get('/api/saved_objects/_find?type=visualization') - .expect(200) - .then((resp) => { - expect(resp.body).to.eql({ - page: 1, - per_page: 20, - total: 0, - saved_objects: [], - }); + ).to.eql(['some*visualization', 'my-visualization']); })); - - describe('unknown type', () => { - it('should return 200 with empty response', async () => - await supertest - .get('/api/saved_objects/_find?type=wigwags') - .expect(200) - .then((resp) => { - expect(resp.body).to.eql({ - page: 1, - per_page: 20, - total: 0, - saved_objects: [], - }); - })); - }); - - describe('missing type', () => { - it('should return 400', async () => - await supertest - .get('/api/saved_objects/_find') - .expect(400) - .then((resp) => { - expect(resp.body).to.eql({ - error: 'Bad Request', - message: - '[request query.type]: expected at least one defined value but got [undefined]', - statusCode: 400, - }); - })); - }); - - describe('page beyond total', () => { - it('should return 200 with empty response', async () => - await supertest - .get('/api/saved_objects/_find?type=visualization&page=100&per_page=100') - .expect(200) - .then((resp) => { - expect(resp.body).to.eql({ - page: 100, - per_page: 100, - total: 0, - saved_objects: [], - }); - })); - }); - - describe('unknown search field', () => { - it('should return 200 with empty response', async () => - await supertest - .get('/api/saved_objects/_find?type=url&search_fields=a') - .expect(200) - .then((resp) => { - expect(resp.body).to.eql({ - page: 1, - per_page: 20, - total: 0, - saved_objects: [], - }); - })); - }); - - describe('with a filter', () => { - it('should return 200 with an empty response', async () => - await supertest - .get( - '/api/saved_objects/_find?type=visualization&filter=visualization.attributes.title:"Count of requests"' - ) - .expect(200) - .then((resp) => { - expect(resp.body).to.eql({ - page: 1, - per_page: 20, - total: 0, - saved_objects: [], - }); - })); - - it('wrong type should return 400 with Bad Request', async () => - await supertest - .get( - '/api/saved_objects/_find?type=visualization&filter=dashboard.attributes.title:foo' - ) - .expect(400) - .then((resp) => { - expect(resp.body).to.eql({ - error: 'Bad Request', - message: 'This type dashboard is not allowed: Bad Request', - statusCode: 400, - }); - })); - }); }); }); } diff --git a/test/api_integration/apis/saved_objects/get.ts b/test/api_integration/apis/saved_objects/get.ts index 94cae01201a664a..77d7b4faacb4149 100644 --- a/test/api_integration/apis/saved_objects/get.ts +++ b/test/api_integration/apis/saved_objects/get.ts @@ -12,88 +12,59 @@ import { getKibanaVersion } from './lib/saved_objects_test_utils'; export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const esArchiver = getService('esArchiver'); - const esDeleteAllIndices = getService('esDeleteAllIndices'); + const kibanaServer = getService('kibanaServer'); describe('get', () => { let KIBANA_VERSION: string; before(async () => { KIBANA_VERSION = await getKibanaVersion(getService); + await kibanaServer.importExport.load('saved_objects/basic'); }); + after(() => kibanaServer.importExport.unload('saved_objects/basic')); - describe('with kibana index', () => { - before(() => - esArchiver.load('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); - after(() => - esArchiver.unload('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); - - it('should return 200', async () => - await supertest - .get(`/api/saved_objects/visualization/dd7caf20-9efd-11e7-acb3-3dab96693fab`) - .expect(200) - .then((resp) => { - expect(resp.body).to.eql({ - id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', - type: 'visualization', - updated_at: '2017-09-21T18:51:23.794Z', - version: resp.body.version, - migrationVersion: resp.body.migrationVersion, - coreMigrationVersion: KIBANA_VERSION, - attributes: { - title: 'Count of requests', - description: '', - version: 1, - // cheat for some of the more complex attributes - visState: resp.body.attributes.visState, - uiStateJSON: resp.body.attributes.uiStateJSON, - kibanaSavedObjectMeta: resp.body.attributes.kibanaSavedObjectMeta, + it('should return 200', async () => + await supertest + .get(`/api/saved_objects/visualization/dd7caf20-9efd-11e7-acb3-3dab96693fab`) + .expect(200) + .then((resp) => { + expect(resp.body).to.eql({ + id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', + type: 'visualization', + updated_at: resp.body.updated_at, + version: resp.body.version, + migrationVersion: resp.body.migrationVersion, + coreMigrationVersion: KIBANA_VERSION, + attributes: { + title: 'Count of requests', + description: '', + version: 1, + // cheat for some of the more complex attributes + visState: resp.body.attributes.visState, + uiStateJSON: resp.body.attributes.uiStateJSON, + kibanaSavedObjectMeta: resp.body.attributes.kibanaSavedObjectMeta, + }, + references: [ + { + type: 'index-pattern', + name: 'kibanaSavedObjectMeta.searchSourceJSON.index', + id: '91200a00-9efd-11e7-acb3-3dab96693fab', }, - references: [ - { - type: 'index-pattern', - name: 'kibanaSavedObjectMeta.searchSourceJSON.index', - id: '91200a00-9efd-11e7-acb3-3dab96693fab', - }, - ], - namespaces: ['default'], - }); - expect(resp.body.migrationVersion).to.be.ok(); - })); - - describe('doc does not exist', () => { - it('should return same generic error as when index does not exist', async () => - await supertest - .get(`/api/saved_objects/visualization/foobar`) - .expect(404) - .then((resp) => { - expect(resp.body).to.eql({ - error: 'Not Found', - message: 'Saved object [visualization/foobar] not found', - statusCode: 404, - }); - })); - }); - }); - - describe('without kibana index', () => { - before( - async () => - // just in case the kibana server has recreated it - await esDeleteAllIndices('.kibana*') - ); + ], + namespaces: ['default'], + }); + expect(resp.body.migrationVersion).to.be.ok(); + })); - it('should return basic 404 without mentioning index', async () => + describe('doc does not exist', () => { + it('should return same generic error as when index does not exist', async () => await supertest - .get('/api/saved_objects/visualization/dd7caf20-9efd-11e7-acb3-3dab96693fab') + .get(`/api/saved_objects/visualization/foobar`) .expect(404) .then((resp) => { expect(resp.body).to.eql({ error: 'Not Found', - message: - 'Saved object [visualization/dd7caf20-9efd-11e7-acb3-3dab96693fab] not found', + message: 'Saved object [visualization/foobar] not found', statusCode: 404, }); })); diff --git a/test/api_integration/apis/saved_objects/import.ts b/test/api_integration/apis/saved_objects/import.ts index b9aad96c2469e19..8d3c0b7bbcea3f8 100644 --- a/test/api_integration/apis/saved_objects/import.ts +++ b/test/api_integration/apis/saved_objects/import.ts @@ -22,7 +22,7 @@ const createConflictError = ( export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const esArchiver = getService('esArchiver'); + const kibanaServer = getService('kibanaServer'); describe('import', () => { // mock success results including metadata @@ -42,203 +42,197 @@ export default function ({ getService }: FtrProviderContext) { meta: { title: 'Requests', icon: 'dashboardApp' }, }; - describe('with kibana index', () => { - describe('with basic data existing', () => { - before(() => - esArchiver.load('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); - after(() => - esArchiver.unload('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); + describe('with basic data existing', () => { + before(() => kibanaServer.importExport.load('saved_objects/basic')); + after(() => kibanaServer.importExport.unload('saved_objects/basic')); - it('should return 415 when no file passed in', async () => { - await supertest - .post('/api/saved_objects/_import') - .expect(415) - .then((resp) => { - expect(resp.body).to.eql({ - statusCode: 415, - error: 'Unsupported Media Type', - message: 'Unsupported Media Type', - }); + it('should return 415 when no file passed in', async () => { + await supertest + .post('/api/saved_objects/_import') + .expect(415) + .then((resp) => { + expect(resp.body).to.eql({ + statusCode: 415, + error: 'Unsupported Media Type', + message: 'Unsupported Media Type', }); - }); + }); + }); - it('should return errors when conflicts exist', async () => { - await supertest - .post('/api/saved_objects/_import') - .attach('file', join(__dirname, '../../fixtures/import.ndjson')) - .expect(200) - .then((resp) => { - expect(resp.body).to.eql({ - success: false, - successCount: 0, - errors: [ - createConflictError(indexPattern), - createConflictError(visualization), - createConflictError(dashboard), - ], - warnings: [], - }); + it('should return errors when conflicts exist', async () => { + await supertest + .post('/api/saved_objects/_import') + .attach('file', join(__dirname, '../../fixtures/import.ndjson')) + .expect(200) + .then((resp) => { + expect(resp.body).to.eql({ + success: false, + successCount: 0, + errors: [ + createConflictError(indexPattern), + createConflictError(visualization), + createConflictError(dashboard), + ], + warnings: [], }); - }); + }); + }); - it('should return 200 when conflicts exist but overwrite is passed in', async () => { - await supertest - .post('/api/saved_objects/_import') - .query({ overwrite: true }) - .attach('file', join(__dirname, '../../fixtures/import.ndjson')) - .expect(200) - .then((resp) => { - expect(resp.body).to.eql({ - success: true, - successCount: 3, - successResults: [ - { ...indexPattern, overwrite: true }, - { ...visualization, overwrite: true }, - { ...dashboard, overwrite: true }, - ], - warnings: [], - }); + it('should return 200 when conflicts exist but overwrite is passed in', async () => { + await supertest + .post('/api/saved_objects/_import') + .query({ overwrite: true }) + .attach('file', join(__dirname, '../../fixtures/import.ndjson')) + .expect(200) + .then((resp) => { + expect(resp.body).to.eql({ + success: true, + successCount: 3, + successResults: [ + { ...indexPattern, overwrite: true }, + { ...visualization, overwrite: true }, + { ...dashboard, overwrite: true }, + ], + warnings: [], }); - }); + }); + }); - it('should return 200 when trying to import unsupported types', async () => { - const fileBuffer = Buffer.from( - '{"id":"1","type":"wigwags","attributes":{"title":"my title"},"references":[]}', - 'utf8' - ); - await supertest - .post('/api/saved_objects/_import') - .attach('file', fileBuffer, 'export.ndjson') - .expect(200) - .then((resp) => { - expect(resp.body).to.eql({ - success: false, - successCount: 0, - errors: [ - { - id: '1', - type: 'wigwags', - title: 'my title', - meta: { title: 'my title' }, - error: { type: 'unsupported_type' }, - }, - ], - warnings: [], - }); + it('should return 200 when trying to import unsupported types', async () => { + const fileBuffer = Buffer.from( + '{"id":"1","type":"wigwags","attributes":{"title":"my title"},"references":[]}', + 'utf8' + ); + await supertest + .post('/api/saved_objects/_import') + .attach('file', fileBuffer, 'export.ndjson') + .expect(200) + .then((resp) => { + expect(resp.body).to.eql({ + success: false, + successCount: 0, + errors: [ + { + id: '1', + type: 'wigwags', + title: 'my title', + meta: { title: 'my title' }, + error: { type: 'unsupported_type' }, + }, + ], + warnings: [], }); - }); + }); + }); - it('should return 200 when importing SO with circular refs', async () => { - const fileBuffer = Buffer.from( - dedent` - {"attributes":{"title":"dashboard-b"},"id":"dashboard-b","references":[{"id":"dashboard-a","name":"circular-dashboard-ref","type":"dashboard"}],"type":"dashboard"} - {"attributes":{"title":"dashboard-a"},"id":"dashboard-a","references":[{"id":"dashboard-b","name":"circular-dashboard-ref","type":"dashboard"}],"type":"dashboard"} - `, - 'utf8' - ); - const resp = await supertest - .post('/api/saved_objects/_import') - .attach('file', fileBuffer, 'export.ndjson') - .expect(200); + it('should return 200 when importing SO with circular refs', async () => { + const fileBuffer = Buffer.from( + dedent` + {"attributes":{"title":"dashboard-b"},"id":"dashboard-b","references":[{"id":"dashboard-a","name":"circular-dashboard-ref","type":"dashboard"}],"type":"dashboard"} + {"attributes":{"title":"dashboard-a"},"id":"dashboard-a","references":[{"id":"dashboard-b","name":"circular-dashboard-ref","type":"dashboard"}],"type":"dashboard"} + `, + 'utf8' + ); + const resp = await supertest + .post('/api/saved_objects/_import') + .attach('file', fileBuffer, 'export.ndjson') + .expect(200); - expect(resp.body).to.eql({ - success: true, - successCount: 2, - successResults: [ - { - id: 'dashboard-b', - meta: { - icon: 'dashboardApp', - title: 'dashboard-b', - }, - type: 'dashboard', + expect(resp.body).to.eql({ + success: true, + successCount: 2, + successResults: [ + { + id: 'dashboard-b', + meta: { + icon: 'dashboardApp', + title: 'dashboard-b', }, - { - id: 'dashboard-a', - meta: { - icon: 'dashboardApp', - title: 'dashboard-a', - }, - type: 'dashboard', + type: 'dashboard', + }, + { + id: 'dashboard-a', + meta: { + icon: 'dashboardApp', + title: 'dashboard-a', }, - ], - warnings: [], - }); + type: 'dashboard', + }, + ], + warnings: [], }); + }); - it('should return 400 when trying to import more than 10,000 objects', async () => { - const fileChunks = []; - for (let i = 0; i <= 10001; i++) { - fileChunks.push(`{"type":"visualization","id":"${i}","attributes":{},"references":[]}`); - } - await supertest - .post('/api/saved_objects/_import') - .attach('file', Buffer.from(fileChunks.join('\n'), 'utf8'), 'export.ndjson') - .expect(400) - .then((resp) => { - expect(resp.body).to.eql({ - statusCode: 400, - error: 'Bad Request', - message: "Can't import more than 10001 objects", - }); + it('should return 400 when trying to import more than 10,000 objects', async () => { + const fileChunks = []; + for (let i = 0; i <= 10001; i++) { + fileChunks.push(`{"type":"visualization","id":"${i}","attributes":{},"references":[]}`); + } + await supertest + .post('/api/saved_objects/_import') + .attach('file', Buffer.from(fileChunks.join('\n'), 'utf8'), 'export.ndjson') + .expect(400) + .then((resp) => { + expect(resp.body).to.eql({ + statusCode: 400, + error: 'Bad Request', + message: "Can't import more than 10001 objects", }); - }); + }); + }); - it('should return errors when index patterns or search are missing', async () => { - const objectsToImport = [ - JSON.stringify({ - type: 'visualization', - id: '1', - attributes: { title: 'My visualization' }, - references: [ - { - name: 'ref_0', - type: 'index-pattern', - id: 'non-existing', - }, + it('should return errors when index patterns or search are missing', async () => { + const objectsToImport = [ + JSON.stringify({ + type: 'visualization', + id: '1', + attributes: { title: 'My visualization' }, + references: [ + { + name: 'ref_0', + type: 'index-pattern', + id: 'non-existing', + }, + { + name: 'ref_1', + type: 'search', + id: 'non-existing-search', + }, + ], + }), + ]; + await supertest + .post('/api/saved_objects/_import') + .attach('file', Buffer.from(objectsToImport.join('\n'), 'utf8'), 'export.ndjson') + .expect(200) + .then((resp) => { + expect(resp.body).to.eql({ + success: false, + successCount: 0, + errors: [ { - name: 'ref_1', - type: 'search', - id: 'non-existing-search', + type: 'visualization', + id: '1', + title: 'My visualization', + meta: { title: 'My visualization', icon: 'visualizeApp' }, + error: { + type: 'missing_references', + references: [ + { + type: 'index-pattern', + id: 'non-existing', + }, + { + type: 'search', + id: 'non-existing-search', + }, + ], + }, }, ], - }), - ]; - await supertest - .post('/api/saved_objects/_import') - .attach('file', Buffer.from(objectsToImport.join('\n'), 'utf8'), 'export.ndjson') - .expect(200) - .then((resp) => { - expect(resp.body).to.eql({ - success: false, - successCount: 0, - errors: [ - { - type: 'visualization', - id: '1', - title: 'My visualization', - meta: { title: 'My visualization', icon: 'visualizeApp' }, - error: { - type: 'missing_references', - references: [ - { - type: 'index-pattern', - id: 'non-existing', - }, - { - type: 'search', - id: 'non-existing-search', - }, - ], - }, - }, - ], - warnings: [], - }); + warnings: [], }); - }); + }); }); }); }); diff --git a/test/api_integration/apis/saved_objects/resolve.ts b/test/api_integration/apis/saved_objects/resolve.ts index a462151cd777967..fcfef0aeb6b5827 100644 --- a/test/api_integration/apis/saved_objects/resolve.ts +++ b/test/api_integration/apis/saved_objects/resolve.ts @@ -12,8 +12,7 @@ import { getKibanaVersion } from './lib/saved_objects_test_utils'; export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const esArchiver = getService('esArchiver'); - const esDeleteAllIndices = getService('esDeleteAllIndices'); + const kibanaServer = getService('kibanaServer'); describe('resolve', () => { let KIBANA_VERSION: string; @@ -23,23 +22,21 @@ export default function ({ getService }: FtrProviderContext) { }); describe('with kibana index', () => { - before(() => - esArchiver.load('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); - after(() => - esArchiver.unload('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); + before(() => kibanaServer.importExport.load('saved_objects/basic')); + after(() => kibanaServer.importExport.unload('saved_objects/basic')); it('should return 200', async () => await supertest .get(`/api/saved_objects/resolve/visualization/dd7caf20-9efd-11e7-acb3-3dab96693fab`) .expect(200) .then((resp) => { + resp.body.saved_object.updated_at = '2015-01-01T00:00:00.000Z'; + expect(resp.body).to.eql({ saved_object: { id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', type: 'visualization', - updated_at: '2017-09-21T18:51:23.794Z', + updated_at: '2015-01-01T00:00:00.000Z', version: resp.body.saved_object.version, migrationVersion: resp.body.saved_object.migrationVersion, coreMigrationVersion: KIBANA_VERSION, @@ -80,26 +77,5 @@ export default function ({ getService }: FtrProviderContext) { })); }); }); - - describe('without kibana index', () => { - before( - async () => - // just in case the kibana server has recreated it - await esDeleteAllIndices('.kibana') - ); - - it('should return basic 404 without mentioning index', async () => - await supertest - .get('/api/saved_objects/resolve/visualization/dd7caf20-9efd-11e7-acb3-3dab96693fab') - .expect(404) - .then((resp) => { - expect(resp.body).to.eql({ - error: 'Not Found', - message: - 'Saved object [visualization/dd7caf20-9efd-11e7-acb3-3dab96693fab] not found', - statusCode: 404, - }); - })); - }); }); } diff --git a/test/api_integration/apis/saved_objects/resolve_import_errors.ts b/test/api_integration/apis/saved_objects/resolve_import_errors.ts index 4914eb5c7b29fd4..43ff01d321f9fad 100644 --- a/test/api_integration/apis/saved_objects/resolve_import_errors.ts +++ b/test/api_integration/apis/saved_objects/resolve_import_errors.ts @@ -12,8 +12,7 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const esArchiver = getService('esArchiver'); - const esDeleteAllIndices = getService('esDeleteAllIndices'); + const kibanaServer = getService('kibanaServer'); describe('resolve_import_errors', () => { // mock success results including metadata @@ -32,49 +31,45 @@ export default function ({ getService }: FtrProviderContext) { id: 'be3733a0-9efe-11e7-acb3-3dab96693fab', meta: { title: 'Requests', icon: 'dashboardApp' }, }; + const SPACE_ID = 'ftr-so-resolve_import_errors'; - describe('without kibana index', () => { - // Cleanup data that got created in import - before( - async () => - // just in case the kibana server has recreated it - await esDeleteAllIndices('.kibana*') - ); + describe('with basic data existing', () => { + before(async () => { + await kibanaServer.spaces.create({ id: SPACE_ID, name: SPACE_ID }); + await kibanaServer.importExport.load('saved_objects/basic', { space: SPACE_ID }); + }); + after(() => kibanaServer.spaces.delete(SPACE_ID)); - it('should return 200 and import nothing when empty parameters are passed in', async () => { + it('should return 200 when skipping all the records', async () => { await supertest - .post('/api/saved_objects/_resolve_import_errors') + .post(`/s/${SPACE_ID}/api/saved_objects/_resolve_import_errors`) .field('retries', '[]') .attach('file', join(__dirname, '../../fixtures/import.ndjson')) .expect(200) .then((resp) => { - expect(resp.body).to.eql({ - success: true, - successCount: 0, - warnings: [], - }); + expect(resp.body).to.eql({ success: true, successCount: 0, warnings: [] }); }); }); - it('should return 200 with internal server errors', async () => { + it('should return 200 when manually overwriting each object', async () => { await supertest - .post('/api/saved_objects/_resolve_import_errors') + .post(`/s/${SPACE_ID}/api/saved_objects/_resolve_import_errors`) .field( 'retries', JSON.stringify([ { - type: 'index-pattern', id: '91200a00-9efd-11e7-acb3-3dab96693fab', + type: 'index-pattern', overwrite: true, }, { - type: 'visualization', id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', + type: 'visualization', overwrite: true, }, { - type: 'dashboard', id: 'be3733a0-9efe-11e7-acb3-3dab96693fab', + type: 'dashboard', overwrite: true, }, ]) @@ -83,110 +78,44 @@ export default function ({ getService }: FtrProviderContext) { .expect(200) .then((resp) => { expect(resp.body).to.eql({ - successCount: 0, - success: false, - errors: [ - { - ...indexPattern, - ...{ title: indexPattern.meta.title }, - overwrite: true, - error: { - statusCode: 500, - error: 'Internal Server Error', - message: 'An internal server error occurred', - type: 'unknown', - }, - }, - { - ...visualization, - ...{ title: visualization.meta.title }, - overwrite: true, - error: { - statusCode: 500, - error: 'Internal Server Error', - message: 'An internal server error occurred', - type: 'unknown', - }, - }, - { - ...dashboard, - ...{ title: dashboard.meta.title }, - overwrite: true, - error: { - statusCode: 500, - error: 'Internal Server Error', - message: 'An internal server error occurred', - type: 'unknown', - }, - }, + success: true, + successCount: 3, + successResults: [ + { ...indexPattern, overwrite: true }, + { ...visualization, overwrite: true }, + { ...dashboard, overwrite: true }, ], warnings: [], }); }); }); - it('should return 400 when no file passed in', async () => { + it('should return 200 with only one record when overwriting 1 and skipping 1', async () => { await supertest - .post('/api/saved_objects/_resolve_import_errors') - .field('retries', '[]') - .expect(400) - .then((resp) => { - expect(resp.body).to.eql({ - statusCode: 400, - error: 'Bad Request', - message: '[request body.file]: expected value of type [Stream] but got [undefined]', - }); - }); - }); - - it('should return 200 when retrying unsupported types', async () => { - const fileBuffer = Buffer.from( - '{"id":"1","type":"wigwags","attributes":{"title":"my title"},"references":[]}', - 'utf8' - ); - await supertest - .post('/api/saved_objects/_resolve_import_errors') - .field('retries', JSON.stringify([{ type: 'wigwags', id: '1' }])) - .attach('file', fileBuffer, 'export.ndjson') + .post(`/s/${SPACE_ID}/api/saved_objects/_resolve_import_errors`) + .field( + 'retries', + JSON.stringify([ + { + id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', + type: 'visualization', + overwrite: true, + }, + ]) + ) + .attach('file', join(__dirname, '../../fixtures/import.ndjson')) .expect(200) .then((resp) => { expect(resp.body).to.eql({ - success: false, - successCount: 0, - errors: [ - { - id: '1', - type: 'wigwags', - title: 'my title', - meta: { title: 'my title' }, - error: { type: 'unsupported_type' }, - }, - ], + success: true, + successCount: 1, + successResults: [{ ...visualization, overwrite: true }], warnings: [], }); }); }); - it('should return 400 when resolving conflicts with a file containing more than 10,001 objects', async () => { - const fileChunks = []; - for (let i = 0; i <= 10001; i++) { - fileChunks.push(`{"type":"visualization","id":"${i}","attributes":{},"references":[]}`); - } - await supertest - .post('/api/saved_objects/_resolve_import_errors') - .field('retries', '[]') - .attach('file', Buffer.from(fileChunks.join('\n'), 'utf8'), 'export.ndjson') - .expect(400) - .then((resp) => { - expect(resp.body).to.eql({ - statusCode: 400, - error: 'Bad Request', - message: "Can't import more than 10001 objects", - }); - }); - }); - - it('should return 200 with errors when missing references', async () => { + it('should return 200 when replacing references', async () => { const objToInsert = { id: '1', type: 'visualization', @@ -203,13 +132,20 @@ export default function ({ getService }: FtrProviderContext) { ], }; await supertest - .post('/api/saved_objects/_resolve_import_errors') + .post(`/s/${SPACE_ID}/api/saved_objects/_resolve_import_errors`) .field( 'retries', JSON.stringify([ { type: 'visualization', id: '1', + replaceReferences: [ + { + type: 'index-pattern', + from: '2', + to: '91200a00-9efd-11e7-acb3-3dab96693fab', + }, + ], }, ]) ) @@ -217,178 +153,30 @@ export default function ({ getService }: FtrProviderContext) { .expect(200) .then((resp) => { expect(resp.body).to.eql({ - success: false, - successCount: 0, - errors: [ + success: true, + successCount: 1, + successResults: [ { - id: '1', type: 'visualization', - title: 'My favorite vis', + id: '1', meta: { title: 'My favorite vis', icon: 'visualizeApp' }, - error: { - type: 'missing_references', - references: [ - { - type: 'index-pattern', - id: '2', - }, - ], - }, }, ], warnings: [], }); }); - }); - }); - - describe('with kibana index', () => { - describe('with basic data existing', () => { - before(() => - esArchiver.load('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); - after(() => - esArchiver.unload('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); - - it('should return 200 when skipping all the records', async () => { - await supertest - .post('/api/saved_objects/_resolve_import_errors') - .field('retries', '[]') - .attach('file', join(__dirname, '../../fixtures/import.ndjson')) - .expect(200) - .then((resp) => { - expect(resp.body).to.eql({ success: true, successCount: 0, warnings: [] }); - }); - }); - - it('should return 200 when manually overwriting each object', async () => { - await supertest - .post('/api/saved_objects/_resolve_import_errors') - .field( - 'retries', - JSON.stringify([ - { - id: '91200a00-9efd-11e7-acb3-3dab96693fab', - type: 'index-pattern', - overwrite: true, - }, - { - id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', - type: 'visualization', - overwrite: true, - }, - { - id: 'be3733a0-9efe-11e7-acb3-3dab96693fab', - type: 'dashboard', - overwrite: true, - }, - ]) - ) - .attach('file', join(__dirname, '../../fixtures/import.ndjson')) - .expect(200) - .then((resp) => { - expect(resp.body).to.eql({ - success: true, - successCount: 3, - successResults: [ - { ...indexPattern, overwrite: true }, - { ...visualization, overwrite: true }, - { ...dashboard, overwrite: true }, - ], - warnings: [], - }); - }); - }); - - it('should return 200 with only one record when overwriting 1 and skipping 1', async () => { - await supertest - .post('/api/saved_objects/_resolve_import_errors') - .field( - 'retries', - JSON.stringify([ - { - id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', - type: 'visualization', - overwrite: true, - }, - ]) - ) - .attach('file', join(__dirname, '../../fixtures/import.ndjson')) - .expect(200) - .then((resp) => { - expect(resp.body).to.eql({ - success: true, - successCount: 1, - successResults: [{ ...visualization, overwrite: true }], - warnings: [], - }); - }); - }); - - it('should return 200 when replacing references', async () => { - const objToInsert = { - id: '1', - type: 'visualization', - attributes: { - title: 'My favorite vis', - visState: '{}', - }, - references: [ + await supertest + .get(`/s/${SPACE_ID}/api/saved_objects/visualization/1`) + .expect(200) + .then((resp) => { + expect(resp.body.references).to.eql([ { name: 'ref_0', type: 'index-pattern', - id: '2', + id: '91200a00-9efd-11e7-acb3-3dab96693fab', }, - ], - }; - await supertest - .post('/api/saved_objects/_resolve_import_errors') - .field( - 'retries', - JSON.stringify([ - { - type: 'visualization', - id: '1', - replaceReferences: [ - { - type: 'index-pattern', - from: '2', - to: '91200a00-9efd-11e7-acb3-3dab96693fab', - }, - ], - }, - ]) - ) - .attach('file', Buffer.from(JSON.stringify(objToInsert), 'utf8'), 'export.ndjson') - .expect(200) - .then((resp) => { - expect(resp.body).to.eql({ - success: true, - successCount: 1, - successResults: [ - { - type: 'visualization', - id: '1', - meta: { title: 'My favorite vis', icon: 'visualizeApp' }, - }, - ], - warnings: [], - }); - }); - await supertest - .get('/api/saved_objects/visualization/1') - .expect(200) - .then((resp) => { - expect(resp.body.references).to.eql([ - { - name: 'ref_0', - type: 'index-pattern', - id: '91200a00-9efd-11e7-acb3-3dab96693fab', - }, - ]); - }); - }); + ]); + }); }); }); }); diff --git a/test/api_integration/apis/saved_objects/update.ts b/test/api_integration/apis/saved_objects/update.ts index be4dd65d3e67df5..75b8651ee64a7cc 100644 --- a/test/api_integration/apis/saved_objects/update.ts +++ b/test/api_integration/apis/saved_objects/update.ts @@ -11,185 +11,153 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const esArchiver = getService('esArchiver'); - const esDeleteAllIndices = getService('esDeleteAllIndices'); + const kibanaServer = getService('kibanaServer'); describe('update', () => { - describe('with kibana index', () => { - before(() => - esArchiver.load('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); - after(() => - esArchiver.unload('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); - it('should return 200', async () => { - await supertest - .put(`/api/saved_objects/visualization/dd7caf20-9efd-11e7-acb3-3dab96693fab`) - .send({ + before(() => kibanaServer.importExport.load('saved_objects/basic')); + after(() => kibanaServer.importExport.unload('saved_objects/basic')); + it('should return 200', async () => { + await supertest + .put(`/api/saved_objects/visualization/dd7caf20-9efd-11e7-acb3-3dab96693fab`) + .send({ + attributes: { + title: 'My second favorite vis', + }, + }) + .expect(200) + .then((resp) => { + // loose uuid validation + expect(resp.body) + .to.have.property('id') + .match(/^[0-9a-f-]{36}$/); + + // loose ISO8601 UTC time with milliseconds validation + expect(resp.body) + .to.have.property('updated_at') + .match(/^[\d-]{10}T[\d:\.]{12}Z$/); + + expect(resp.body).to.eql({ + id: resp.body.id, + type: 'visualization', + updated_at: resp.body.updated_at, + version: resp.body.version, attributes: { title: 'My second favorite vis', }, - }) - .expect(200) - .then((resp) => { - // loose uuid validation - expect(resp.body) - .to.have.property('id') - .match(/^[0-9a-f-]{36}$/); - - // loose ISO8601 UTC time with milliseconds validation - expect(resp.body) - .to.have.property('updated_at') - .match(/^[\d-]{10}T[\d:\.]{12}Z$/); - - expect(resp.body).to.eql({ - id: resp.body.id, - type: 'visualization', - updated_at: resp.body.updated_at, - version: resp.body.version, - attributes: { - title: 'My second favorite vis', - }, - namespaces: ['default'], - }); + namespaces: ['default'], }); - }); - - it('does not pass references if omitted', async () => { - const resp = await supertest - .put(`/api/saved_objects/visualization/dd7caf20-9efd-11e7-acb3-3dab96693fab`) - .send({ - attributes: { - title: 'foo', - }, - }) - .expect(200); - - expect(resp.body).not.to.have.property('references'); - }); - - it('passes references if they are provided', async () => { - const references = [{ id: 'foo', name: 'Foo', type: 'visualization' }]; - - const resp = await supertest - .put(`/api/saved_objects/visualization/dd7caf20-9efd-11e7-acb3-3dab96693fab`) - .send({ - attributes: { - title: 'foo', - }, - references, - }) - .expect(200); - - expect(resp.body).to.have.property('references'); - expect(resp.body.references).to.eql(references); - }); - - it('passes empty references array if empty references array is provided', async () => { - const resp = await supertest - .put(`/api/saved_objects/visualization/dd7caf20-9efd-11e7-acb3-3dab96693fab`) - .send({ - attributes: { - title: 'foo', - }, - references: [], - }) - .expect(200); - - expect(resp.body).to.have.property('references'); - expect(resp.body.references).to.eql([]); - }); - - it('handles upsert', async () => { - await supertest - .put(`/api/saved_objects/visualization/upserted-viz`) - .send({ - attributes: { - title: 'foo', - }, - upsert: { - title: 'upserted title', - description: 'upserted description', - }, - }) - .expect(200); - - const { body: upserted } = await supertest - .get(`/api/saved_objects/visualization/upserted-viz`) - .expect(200); - - expect(upserted.attributes).to.eql({ - title: 'upserted title', - description: 'upserted description', }); + }); - await supertest - .put(`/api/saved_objects/visualization/upserted-viz`) - .send({ - attributes: { - title: 'foobar', - }, - upsert: { - description: 'new upserted description', - version: 9000, - }, - }) - .expect(200); + it('does not pass references if omitted', async () => { + const resp = await supertest + .put(`/api/saved_objects/visualization/dd7caf20-9efd-11e7-acb3-3dab96693fab`) + .send({ + attributes: { + title: 'foo', + }, + }) + .expect(200); + + expect(resp.body).not.to.have.property('references'); + }); - const { body: notUpserted } = await supertest - .get(`/api/saved_objects/visualization/upserted-viz`) - .expect(200); + it('passes references if they are provided', async () => { + const references = [{ id: 'foo', name: 'Foo', type: 'visualization' }]; + + const resp = await supertest + .put(`/api/saved_objects/visualization/dd7caf20-9efd-11e7-acb3-3dab96693fab`) + .send({ + attributes: { + title: 'foo', + }, + references, + }) + .expect(200); + + expect(resp.body).to.have.property('references'); + expect(resp.body.references).to.eql(references); + }); - expect(notUpserted.attributes).to.eql({ - title: 'foobar', - description: 'upserted description', - }); + it('passes empty references array if empty references array is provided', async () => { + const resp = await supertest + .put(`/api/saved_objects/visualization/dd7caf20-9efd-11e7-acb3-3dab96693fab`) + .send({ + attributes: { + title: 'foo', + }, + references: [], + }) + .expect(200); + + expect(resp.body).to.have.property('references'); + expect(resp.body.references).to.eql([]); + }); + + it('handles upsert', async () => { + await supertest + .put(`/api/saved_objects/visualization/upserted-viz`) + .send({ + attributes: { + title: 'foo', + }, + upsert: { + title: 'upserted title', + description: 'upserted description', + }, + }) + .expect(200); + + const { body: upserted } = await supertest + .get(`/api/saved_objects/visualization/upserted-viz`) + .expect(200); + + expect(upserted.attributes).to.eql({ + title: 'upserted title', + description: 'upserted description', }); - describe('unknown id', () => { - it('should return a generic 404', async () => { - await supertest - .put(`/api/saved_objects/visualization/not an id`) - .send({ - attributes: { - title: 'My second favorite vis', - }, - }) - .expect(404) - .then((resp) => { - expect(resp.body).eql({ - statusCode: 404, - error: 'Not Found', - message: 'Saved object [visualization/not an id] not found', - }); - }); - }); + await supertest + .put(`/api/saved_objects/visualization/upserted-viz`) + .send({ + attributes: { + title: 'foobar', + }, + upsert: { + description: 'new upserted description', + version: 9000, + }, + }) + .expect(200); + + const { body: notUpserted } = await supertest + .get(`/api/saved_objects/visualization/upserted-viz`) + .expect(200); + + expect(notUpserted.attributes).to.eql({ + title: 'foobar', + description: 'upserted description', }); }); - describe('without kibana index', () => { - before( - async () => - // just in case the kibana server has recreated it - await esDeleteAllIndices('.kibana*') - ); - - it('should return 500', async () => + describe('unknown id', () => { + it('should return a generic 404', async () => { await supertest - .put(`/api/saved_objects/visualization/dd7caf20-9efd-11e7-acb3-3dab96693fab`) + .put(`/api/saved_objects/visualization/not an id`) .send({ attributes: { title: 'My second favorite vis', }, }) - .expect(500) + .expect(404) .then((resp) => { expect(resp.body).eql({ - statusCode: 500, - error: 'Internal Server Error', - message: 'An internal server error occurred.', + statusCode: 404, + error: 'Not Found', + message: 'Saved object [visualization/not an id] not found', }); - })); + }); + }); }); }); } diff --git a/test/api_integration/apis/saved_objects_management/find.ts b/test/api_integration/apis/saved_objects_management/find.ts index 118f2fb1e91ebd0..6aefd74f0f36b2e 100644 --- a/test/api_integration/apis/saved_objects_management/find.ts +++ b/test/api_integration/apis/saved_objects_management/find.ts @@ -11,7 +11,6 @@ import { Response } from 'supertest'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { - const esDeleteAllIndices = getService('esDeleteAllIndices'); const supertest = getService('supertest'); const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); @@ -26,12 +25,8 @@ export default function ({ getService }: FtrProviderContext) { }); describe('with kibana index', () => { - before(() => - esArchiver.load('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); - after(() => - esArchiver.unload('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); + before(() => kibanaServer.importExport.load('saved_objects/basic')); + after(() => kibanaServer.importExport.unload('saved_objects/basic')); it('should return 200 with individual responses', async () => await supertest @@ -90,12 +85,8 @@ export default function ({ getService }: FtrProviderContext) { }); describe('`hasReference` and `hasReferenceOperator` parameters', () => { - before(() => - esArchiver.load('test/api_integration/fixtures/es_archiver/saved_objects/references') - ); - after(() => - esArchiver.unload('test/api_integration/fixtures/es_archiver/saved_objects/references') - ); + before(() => kibanaServer.importExport.load('saved_objects/references')); + after(() => kibanaServer.importExport.unload('saved_objects/references')); it('search for a reference', async () => { await supertest @@ -127,8 +118,8 @@ export default function ({ getService }: FtrProviderContext) { const objects = resp.body.saved_objects; expect(objects.map((obj: any) => obj.id)).to.eql([ 'only-ref-1', - 'ref-1-and-ref-2', 'only-ref-2', + 'ref-1-and-ref-2', ]); }); }); @@ -153,88 +144,6 @@ export default function ({ getService }: FtrProviderContext) { }); }); - describe('without kibana index', () => { - before( - async () => - // just in case the kibana server has recreated it - await esDeleteAllIndices('.kibana*') - ); - - it('should return 200 with empty response', async () => - await supertest - .get('/api/kibana/management/saved_objects/_find?type=visualization') - .expect(200) - .then((resp: Response) => { - expect(resp.body).to.eql({ - page: 1, - per_page: 20, - total: 0, - saved_objects: [], - }); - })); - - describe('unknown type', () => { - it('should return 200 with empty response', async () => - await supertest - .get('/api/kibana/management/saved_objects/_find?type=wigwags') - .expect(200) - .then((resp: Response) => { - expect(resp.body).to.eql({ - page: 1, - per_page: 20, - total: 0, - saved_objects: [], - }); - })); - }); - - describe('missing type', () => { - it('should return 400', async () => - await supertest - .get('/api/kibana/management/saved_objects/_find') - .expect(400) - .then((resp: Response) => { - expect(resp.body).to.eql({ - error: 'Bad Request', - message: - '[request query.type]: expected at least one defined value but got [undefined]', - statusCode: 400, - }); - })); - }); - - describe('page beyond total', () => { - it('should return 200 with empty response', async () => - await supertest - .get( - '/api/kibana/management/saved_objects/_find?type=visualization&page=100&perPage=100' - ) - .expect(200) - .then((resp: Response) => { - expect(resp.body).to.eql({ - page: 100, - per_page: 100, - total: 0, - saved_objects: [], - }); - })); - }); - - describe('unknown search field', () => { - it('should return 400 when using searchFields', async () => - await supertest - .get('/api/kibana/management/saved_objects/_find?type=url&searchFields=a') - .expect(400) - .then((resp: Response) => { - expect(resp.body).to.eql({ - statusCode: 400, - error: 'Bad Request', - message: '[request query.searchFields]: definition for this key is missing', - }); - })); - }); - }); - describe('meta attributes injected properly', () => { before(() => esArchiver.load('test/api_integration/fixtures/es_archiver/management/saved_objects/search') diff --git a/test/api_integration/apis/saved_objects_management/get.ts b/test/api_integration/apis/saved_objects_management/get.ts index 5c6ea9d222d97b3..eb0b832cb2ed14c 100644 --- a/test/api_integration/apis/saved_objects_management/get.ts +++ b/test/api_integration/apis/saved_objects_management/get.ts @@ -11,49 +11,29 @@ import { Response } from 'supertest'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { - const esDeleteAllIndices = getService('esDeleteAllIndices'); const supertest = getService('supertest'); - const esArchiver = getService('esArchiver'); + const kibanaServer = getService('kibanaServer'); describe('get', () => { const existingObject = 'visualization/dd7caf20-9efd-11e7-acb3-3dab96693fab'; const nonexistentObject = 'wigwags/foo'; - describe('with kibana index', () => { - before(() => - esArchiver.load('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); - after(() => - esArchiver.unload('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); - - it('should return 200 for object that exists and inject metadata', async () => - await supertest - .get(`/api/kibana/management/saved_objects/${existingObject}`) - .expect(200) - .then((resp: Response) => { - const { body } = resp; - const { type, id, meta } = body; - expect(type).to.eql('visualization'); - expect(id).to.eql('dd7caf20-9efd-11e7-acb3-3dab96693fab'); - expect(meta).to.not.equal(undefined); - })); - - it('should return 404 for object that does not exist', async () => - await supertest - .get(`/api/kibana/management/saved_objects/${nonexistentObject}`) - .expect(404)); - }); - - describe('without kibana index', () => { - before( - async () => - // just in case the kibana server has recreated it - await esDeleteAllIndices('.kibana*') - ); - - it('should return 404 for object that no longer exists', async () => - await supertest.get(`/api/kibana/management/saved_objects/${existingObject}`).expect(404)); - }); + before(() => kibanaServer.importExport.load('saved_objects/basic')); + after(() => kibanaServer.importExport.unload('saved_objects/basic')); + + it('should return 200 for object that exists and inject metadata', async () => + await supertest + .get(`/api/kibana/management/saved_objects/${existingObject}`) + .expect(200) + .then((resp: Response) => { + const { body } = resp; + const { type, id, meta } = body; + expect(type).to.eql('visualization'); + expect(id).to.eql('dd7caf20-9efd-11e7-acb3-3dab96693fab'); + expect(meta).to.not.equal(undefined); + })); + + it('should return 404 for object that does not exist', async () => + await supertest.get(`/api/kibana/management/saved_objects/${nonexistentObject}`).expect(404)); }); } diff --git a/test/api_integration/apis/saved_objects_management/relationships.ts b/test/api_integration/apis/saved_objects_management/relationships.ts index a9db49f40cf5b0d..ffc97b138595715 100644 --- a/test/api_integration/apis/saved_objects_management/relationships.ts +++ b/test/api_integration/apis/saved_objects_management/relationships.ts @@ -12,7 +12,7 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const esArchiver = getService('esArchiver'); + const kibanaServer = getService('kibanaServer'); const relationSchema = schema.object({ id: schema.string(), @@ -43,16 +43,8 @@ export default function ({ getService }: FtrProviderContext) { }); describe('relationships', () => { - before(async () => { - await esArchiver.load( - 'test/api_integration/fixtures/es_archiver/management/saved_objects/relationships' - ); - }); - after(async () => { - await esArchiver.unload( - 'test/api_integration/fixtures/es_archiver/management/saved_objects/relationships' - ); - }); + before(() => kibanaServer.importExport.load('management/saved_objects/relationships')); + after(() => kibanaServer.importExport.unload('management/saved_objects/relationships')); const baseApiUrl = `/api/kibana/management/saved_objects/relationships`; const defaultTypes = ['visualization', 'index-pattern', 'search', 'dashboard']; diff --git a/test/api_integration/apis/shorten/index.js b/test/api_integration/apis/shorten/index.js index 5aa0fced78b40b1..9af979b6af95d78 100644 --- a/test/api_integration/apis/shorten/index.js +++ b/test/api_integration/apis/shorten/index.js @@ -9,12 +9,12 @@ import expect from '@kbn/expect'; export default function ({ getService }) { - const esArchiver = getService('esArchiver'); const supertest = getService('supertest'); + const kibanaServer = getService('kibanaServer'); describe('url shortener', () => { - before(() => esArchiver.load('test/api_integration/fixtures/es_archiver/saved_objects/basic')); - after(() => esArchiver.unload('test/api_integration/fixtures/es_archiver/saved_objects/basic')); + before(() => kibanaServer.importExport.load('saved_objects/basic')); + after(() => kibanaServer.importExport.unload('saved_objects/basic')); it('generates shortened urls', async () => { const resp = await supertest diff --git a/test/api_integration/apis/stats/stats.js b/test/api_integration/apis/stats/stats.js index a783e40ed52506d..2ba14e29a3d1a86 100644 --- a/test/api_integration/apis/stats/stats.js +++ b/test/api_integration/apis/stats/stats.js @@ -44,15 +44,11 @@ const assertStatsAndMetrics = (body) => { export default function ({ getService }) { const supertest = getService('supertest'); - const esArchiver = getService('esArchiver'); + const kibanaServer = getService('kibanaServer'); describe('kibana stats api', () => { - before('make sure there are some saved objects', () => - esArchiver.load('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); - after('cleanup saved objects changes', () => - esArchiver.unload('test/api_integration/fixtures/es_archiver/saved_objects/basic') - ); + before(() => kibanaServer.importExport.load('saved_objects/basic')); + after(() => kibanaServer.importExport.unload('saved_objects/basic')); describe('basic', () => { it('should return the stats without cluster_uuid with no query string params', () => { diff --git a/test/api_integration/apis/suggestions/suggestions.js b/test/api_integration/apis/suggestions/suggestions.js index d7affcbe7278018..526cb9669f27886 100644 --- a/test/api_integration/apis/suggestions/suggestions.js +++ b/test/api_integration/apis/suggestions/suggestions.js @@ -8,22 +8,19 @@ export default function ({ getService }) { const esArchiver = getService('esArchiver'); + const kibanaServer = getService('kibanaServer'); const supertest = getService('supertest'); describe('Suggestions API', function () { before(async () => { await esArchiver.load('test/api_integration/fixtures/es_archiver/index_patterns/basic_index'); - await esArchiver.load( - 'test/api_integration/fixtures/es_archiver/index_patterns/basic_kibana' - ); + await kibanaServer.importExport.load('index_patterns/basic_kibana'); }); after(async () => { await esArchiver.unload( 'test/api_integration/fixtures/es_archiver/index_patterns/basic_index' ); - await esArchiver.unload( - 'test/api_integration/fixtures/es_archiver/index_patterns/basic_kibana' - ); + await kibanaServer.importExport.unload('index_patterns/basic_kibana'); }); it('should return 200 with special characters', () => diff --git a/test/api_integration/config.js b/test/api_integration/config.js index 7bbace4c60570b5..84fb0b7907c3b0a 100644 --- a/test/api_integration/config.js +++ b/test/api_integration/config.js @@ -31,6 +31,7 @@ export default async function ({ readConfigFile }) { '--server.xsrf.disableProtection=true', '--server.compression.referrerWhitelist=["some-host.com"]', `--savedObjects.maxImportExportSize=10001`, + '--savedObjects.maxImportPayloadBytes=30000000', // for testing set buffer duration to 0 to immediately flush counters into saved objects. '--usageCollection.usageCounters.bufferDuration=0', ], diff --git a/test/api_integration/fixtures/es_archiver/index_patterns/basic_kibana/data.json b/test/api_integration/fixtures/es_archiver/index_patterns/basic_kibana/data.json deleted file mode 100644 index 54276b59dcc231e..000000000000000 --- a/test/api_integration/fixtures/es_archiver/index_patterns/basic_kibana/data.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "type": "doc", - "value": { - "index": ".kibana", - "id": "index-pattern:91200a00-9efd-11e7-acb3-3dab96693fab", - "source": { - "type": "index-pattern", - "updated_at": "2017-09-21T18:49:16.270Z", - "index-pattern": { - "title": "basic_index", - "fields": "[{\"name\":\"bar\",\"type\":\"boolean\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"baz\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"baz.keyword\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"foo\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"nestedField.child\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"nested\":{\"path\":\"nestedField\"}}}]" - } - } - } -} diff --git a/test/api_integration/fixtures/es_archiver/index_patterns/basic_kibana/mappings.json b/test/api_integration/fixtures/es_archiver/index_patterns/basic_kibana/mappings.json deleted file mode 100644 index a87f0bd186c973f..000000000000000 --- a/test/api_integration/fixtures/es_archiver/index_patterns/basic_kibana/mappings.json +++ /dev/null @@ -1,256 +0,0 @@ -{ - "type": "index", - "value": { - "aliases": { - ".kibana": {} - }, - "index": ".kibana_1", - "settings": { - "index": { - "number_of_shards": "1", - "number_of_replicas": "1" - } - }, - "mappings": { - "dynamic": "strict", - "properties": { - "config": { - "dynamic": "true", - "properties": { - "buildNum": { - "type": "keyword" - }, - "defaultIndex": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - }, - "dashboard": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "optionsJSON": { - "type": "text" - }, - "panelsJSON": { - "type": "text" - }, - "refreshInterval": { - "properties": { - "display": { - "type": "keyword" - }, - "pause": { - "type": "boolean" - }, - "section": { - "type": "integer" - }, - "value": { - "type": "integer" - } - } - }, - "timeFrom": { - "type": "keyword" - }, - "timeRestore": { - "type": "boolean" - }, - "timeTo": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "index-pattern": { - "properties": { - "fieldFormatMap": { - "type": "text" - }, - "fields": { - "type": "text" - }, - "intervalName": { - "type": "keyword" - }, - "notExpandable": { - "type": "boolean" - }, - "sourceFilters": { - "type": "text" - }, - "timeFieldName": { - "type": "keyword" - }, - "title": { - "type": "text" - } - } - }, - "search": { - "properties": { - "columns": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "sort": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "server": { - "properties": { - "uuid": { - "type": "keyword" - } - } - }, - "timelion-sheet": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timelion_chart_height": { - "type": "integer" - }, - "timelion_columns": { - "type": "integer" - }, - "timelion_interval": { - "type": "keyword" - }, - "timelion_other_interval": { - "type": "keyword" - }, - "timelion_rows": { - "type": "integer" - }, - "timelion_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "namespace": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "updated_at": { - "type": "date" - }, - "url": { - "properties": { - "accessCount": { - "type": "long" - }, - "accessDate": { - "type": "date" - }, - "createDate": { - "type": "date" - }, - "url": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 2048 - } - } - } - } - }, - "visualization": { - "properties": { - "description": { - "type": "text" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "savedSearchId": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - }, - "visState": { - "type": "text" - } - } - } - } - } - } -} diff --git a/test/api_integration/fixtures/es_archiver/management/saved_objects/relationships/data.json b/test/api_integration/fixtures/es_archiver/management/saved_objects/relationships/data.json deleted file mode 100644 index 21d84c4b55e555a..000000000000000 --- a/test/api_integration/fixtures/es_archiver/management/saved_objects/relationships/data.json +++ /dev/null @@ -1,190 +0,0 @@ -{ - "type": "doc", - "value": { - "index": ".kibana", - "id": "timelion-sheet:190f3e90-2ec3-11e8-ba48-69fc4e41e1f6", - "source": { - "type": "timelion-sheet", - "updated_at": "2018-03-23T17:53:30.872Z", - "timelion-sheet": { - "title": "New TimeLion Sheet", - "hits": 0, - "description": "", - "timelion_sheet": [ - ".es(*)" - ], - "timelion_interval": "auto", - "timelion_chart_height": 275, - "timelion_columns": 2, - "timelion_rows": 2, - "version": 1 - } - } - } -} - -{ - "type": "doc", - "value": { - "index": ".kibana", - "id": "index-pattern:8963ca30-3224-11e8-a572-ffca06da1357", - "source": { - "type": "index-pattern", - "updated_at": "2018-03-28T01:08:34.290Z", - "index-pattern": { - "title": "saved_objects*", - "fields": "[{\"name\":\"_id\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_score\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_source\",\"type\":\"_source\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"id\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true}]" - } - } - } -} - -{ - "type": "doc", - "value": { - "index": ".kibana", - "id": "config:7.0.0-alpha1", - "source": { - "type": "config", - "updated_at": "2018-03-28T01:08:39.248Z", - "config": { - "buildNum": 8467, - "telemetry:optIn": false, - "defaultIndex": "8963ca30-3224-11e8-a572-ffca06da1357" - } - } - } -} - -{ - "type": "doc", - "value": { - "index": ".kibana", - "id": "search:960372e0-3224-11e8-a572-ffca06da1357", - "source": { - "type": "search", - "updated_at": "2018-03-28T01:08:55.182Z", - "search": { - "title": "OneRecord", - "description": "", - "hits": 0, - "columns": [ - "_source" - ], - "sort": [ - "_score", - "desc" - ], - "version": 1, - "kibanaSavedObjectMeta": { - "searchSourceJSON": "{\"index\":\"8963ca30-3224-11e8-a572-ffca06da1357\",\"highlightAll\":true,\"version\":true,\"query\":{\"query\":\"id:3\",\"language\":\"lucene\"},\"filter\":[]}" - } - } - } - } -} - -{ - "type": "doc", - "value": { - "index": ".kibana", - "id": "visualization:a42c0580-3224-11e8-a572-ffca06da1357", - "source": { - "type": "visualization", - "updated_at": "2018-03-28T01:09:18.936Z", - "visualization": { - "title": "VisualizationFromSavedSearch", - "visState": "{\"title\":\"VisualizationFromSavedSearch\",\"type\":\"table\",\"params\":{\"perPage\":10,\"showPartialRows\":false,\"showMeticsAtAllLevels\":false,\"sort\":{\"columnIndex\":null,\"direction\":null},\"showTotal\":false,\"totalFunc\":\"sum\"},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}}]}", - "uiStateJSON": "{\"vis\":{\"params\":{\"sort\":{\"columnIndex\":null,\"direction\":null}}}}", - "description": "", - "savedSearchId": "960372e0-3224-11e8-a572-ffca06da1357", - "version": 1, - "kibanaSavedObjectMeta": { - "searchSourceJSON": "{\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"}}" - } - } - } - } -} - -{ - "type": "doc", - "value": { - "index": ".kibana", - "id": "visualization:add810b0-3224-11e8-a572-ffca06da1357", - "source": { - "type": "visualization", - "updated_at": "2018-03-28T01:09:35.163Z", - "visualization": { - "title": "Visualization", - "visState": "{\"title\":\"Visualization\",\"type\":\"metric\",\"params\":{\"addTooltip\":true,\"addLegend\":false,\"type\":\"metric\",\"metric\":{\"percentageMode\":false,\"useRanges\":false,\"colorSchema\":\"Green to Red\",\"metricColorMode\":\"None\",\"colorsRange\":[{\"from\":0,\"to\":10000}],\"labels\":{\"show\":true},\"invertColors\":false,\"style\":{\"bgFill\":\"#000\",\"bgColor\":false,\"labelColor\":false,\"subText\":\"\",\"fontSize\":60}}},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}}]}", - "uiStateJSON": "{}", - "description": "", - "version": 1, - "kibanaSavedObjectMeta": { - "searchSourceJSON": "{\"index\":\"8963ca30-3224-11e8-a572-ffca06da1357\",\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"}}" - } - } - } - } -} - -{ - "type": "doc", - "value": { - "index": ".kibana", - "id": "dashboard:b70c7ae0-3224-11e8-a572-ffca06da1357", - "source": { - "type": "dashboard", - "updated_at": "2018-03-28T01:09:50.606Z", - "dashboard": { - "title": "Dashboard", - "hits": 0, - "description": "", - "panelsJSON": "[{\"gridData\":{\"w\":24,\"h\":15,\"x\":0,\"y\":0,\"i\":\"1\"},\"version\":\"7.0.0-alpha1\",\"panelIndex\":\"1\",\"type\":\"visualization\",\"id\":\"add810b0-3224-11e8-a572-ffca06da1357\",\"embeddableConfig\":{}},{\"gridData\":{\"w\":24,\"h\":15,\"x\":24,\"y\":0,\"i\":\"2\"},\"version\":\"7.0.0-alpha1\",\"panelIndex\":\"2\",\"type\":\"visualization\",\"id\":\"a42c0580-3224-11e8-a572-ffca06da1357\",\"embeddableConfig\":{}}]", - "optionsJSON": "{\"darkTheme\":false,\"useMargins\":true,\"hidePanelTitles\":false}", - "version": 1, - "timeRestore": false, - "kibanaSavedObjectMeta": { - "searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[],\"highlightAll\":true,\"version\":true}" - } - } - } - } -} - -{ - "type": "doc", - "value": { - "index": ".kibana", - "id": "dashboard:invalid-refs", - "source": { - "type": "dashboard", - "updated_at": "2018-03-28T01:09:50.606Z", - "dashboard": { - "title": "Dashboard", - "hits": 0, - "description": "", - "panelsJSON": "[]", - "optionsJSON": "{}", - "version": 1, - "timeRestore": false, - "kibanaSavedObjectMeta": { - "searchSourceJSON": "{}" - } - }, - "references": [ - { - "type":"visualization", - "id": "add810b0-3224-11e8-a572-ffca06da1357", - "name": "valid-ref" - }, - { - "type":"visualization", - "id": "invalid-vis", - "name": "missing-ref" - } - ] - } - } -} diff --git a/test/api_integration/fixtures/es_archiver/management/saved_objects/relationships/mappings.json b/test/api_integration/fixtures/es_archiver/management/saved_objects/relationships/mappings.json deleted file mode 100644 index ecf5b73b9eb2fb6..000000000000000 --- a/test/api_integration/fixtures/es_archiver/management/saved_objects/relationships/mappings.json +++ /dev/null @@ -1,300 +0,0 @@ -{ - "type": "index", - "value": { - "aliases": { - ".kibana": {} - }, - "index": ".kibana_1", - "settings": { - "index": { - "number_of_shards": "1", - "auto_expand_replicas": "0-1", - "number_of_replicas": "0" - } - }, - "mappings": { - "dynamic": "strict", - "properties": { - "references": { - "properties": { - "id": { - "type": "keyword" - }, - "name": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - }, - "type": "nested" - }, - "config": { - "dynamic": "true", - "properties": { - "buildNum": { - "type": "keyword" - }, - "defaultIndex": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "telemetry:optIn": { - "type": "boolean" - } - } - }, - "dashboard": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "optionsJSON": { - "type": "text" - }, - "panelsJSON": { - "type": "text" - }, - "refreshInterval": { - "properties": { - "display": { - "type": "keyword" - }, - "pause": { - "type": "boolean" - }, - "section": { - "type": "integer" - }, - "value": { - "type": "integer" - } - } - }, - "timeFrom": { - "type": "keyword" - }, - "timeRestore": { - "type": "boolean" - }, - "timeTo": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "graph-workspace": { - "properties": { - "description": { - "type": "text" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "numLinks": { - "type": "integer" - }, - "numVertices": { - "type": "integer" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - }, - "wsState": { - "type": "text" - } - } - }, - "index-pattern": { - "properties": { - "fieldFormatMap": { - "type": "text" - }, - "fields": { - "type": "text" - }, - "intervalName": { - "type": "keyword" - }, - "notExpandable": { - "type": "boolean" - }, - "sourceFilters": { - "type": "text" - }, - "timeFieldName": { - "type": "keyword" - }, - "title": { - "type": "text" - } - } - }, - "search": { - "properties": { - "columns": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "sort": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "server": { - "properties": { - "uuid": { - "type": "keyword" - } - } - }, - "timelion-sheet": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timelion_chart_height": { - "type": "integer" - }, - "timelion_columns": { - "type": "integer" - }, - "timelion_interval": { - "type": "keyword" - }, - "timelion_other_interval": { - "type": "keyword" - }, - "timelion_rows": { - "type": "integer" - }, - "timelion_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "type": { - "type": "keyword" - }, - "updated_at": { - "type": "date" - }, - "url": { - "properties": { - "accessCount": { - "type": "long" - }, - "accessDate": { - "type": "date" - }, - "createDate": { - "type": "date" - }, - "url": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 2048 - } - } - } - } - }, - "visualization": { - "properties": { - "description": { - "type": "text" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "savedSearchId": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - }, - "visState": { - "type": "text" - } - } - } - } - } - } -} diff --git a/test/api_integration/fixtures/es_archiver/saved_objects/10k/data.json.gz b/test/api_integration/fixtures/es_archiver/saved_objects/10k/data.json.gz deleted file mode 100644 index b1a2b4301f4d82e..000000000000000 Binary files a/test/api_integration/fixtures/es_archiver/saved_objects/10k/data.json.gz and /dev/null differ diff --git a/test/api_integration/fixtures/es_archiver/saved_objects/10k/mappings.json b/test/api_integration/fixtures/es_archiver/saved_objects/10k/mappings.json deleted file mode 100644 index a87f0bd186c973f..000000000000000 --- a/test/api_integration/fixtures/es_archiver/saved_objects/10k/mappings.json +++ /dev/null @@ -1,256 +0,0 @@ -{ - "type": "index", - "value": { - "aliases": { - ".kibana": {} - }, - "index": ".kibana_1", - "settings": { - "index": { - "number_of_shards": "1", - "number_of_replicas": "1" - } - }, - "mappings": { - "dynamic": "strict", - "properties": { - "config": { - "dynamic": "true", - "properties": { - "buildNum": { - "type": "keyword" - }, - "defaultIndex": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - }, - "dashboard": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "optionsJSON": { - "type": "text" - }, - "panelsJSON": { - "type": "text" - }, - "refreshInterval": { - "properties": { - "display": { - "type": "keyword" - }, - "pause": { - "type": "boolean" - }, - "section": { - "type": "integer" - }, - "value": { - "type": "integer" - } - } - }, - "timeFrom": { - "type": "keyword" - }, - "timeRestore": { - "type": "boolean" - }, - "timeTo": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "index-pattern": { - "properties": { - "fieldFormatMap": { - "type": "text" - }, - "fields": { - "type": "text" - }, - "intervalName": { - "type": "keyword" - }, - "notExpandable": { - "type": "boolean" - }, - "sourceFilters": { - "type": "text" - }, - "timeFieldName": { - "type": "keyword" - }, - "title": { - "type": "text" - } - } - }, - "search": { - "properties": { - "columns": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "sort": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "server": { - "properties": { - "uuid": { - "type": "keyword" - } - } - }, - "timelion-sheet": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timelion_chart_height": { - "type": "integer" - }, - "timelion_columns": { - "type": "integer" - }, - "timelion_interval": { - "type": "keyword" - }, - "timelion_other_interval": { - "type": "keyword" - }, - "timelion_rows": { - "type": "integer" - }, - "timelion_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "namespace": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "updated_at": { - "type": "date" - }, - "url": { - "properties": { - "accessCount": { - "type": "long" - }, - "accessDate": { - "type": "date" - }, - "createDate": { - "type": "date" - }, - "url": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 2048 - } - } - } - } - }, - "visualization": { - "properties": { - "description": { - "type": "text" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "savedSearchId": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - }, - "visState": { - "type": "text" - } - } - } - } - } - } -} diff --git a/test/api_integration/fixtures/es_archiver/saved_objects/basic/data.json.gz b/test/api_integration/fixtures/es_archiver/saved_objects/basic/data.json.gz deleted file mode 100644 index d65e1920b234255..000000000000000 Binary files a/test/api_integration/fixtures/es_archiver/saved_objects/basic/data.json.gz and /dev/null differ diff --git a/test/api_integration/fixtures/es_archiver/saved_objects/basic/mappings.json b/test/api_integration/fixtures/es_archiver/saved_objects/basic/mappings.json deleted file mode 100644 index 6dac52137ef010a..000000000000000 --- a/test/api_integration/fixtures/es_archiver/saved_objects/basic/mappings.json +++ /dev/null @@ -1,2866 +0,0 @@ -{ - "type": "index", - "value": { - "aliases": { - ".kibana": { - } - }, - "index": ".kibana_1", - "mappings": { - "_meta": { - "migrationMappingPropertyHashes": { - "action": "6e96ac5e648f57523879661ea72525b7", - "action_task_params": "a9d49f184ee89641044be0ca2950fa3a", - "alert": "05d57e6963593484582a4de341446974", - "api_key_pending_invalidation": "16f515278a295f6245149ad7c5ddedb7", - "apm-indices": "9bb9b2bf1fa636ed8619cbab5ce6a1dd", - "apm-telemetry": "3d1b76c39bfb2cc8296b024d73854724", - "app_search_telemetry": "3d1b76c39bfb2cc8296b024d73854724", - "application_usage_daily": "43b8830d5d0df85a6823d290885fc9fd", - "application_usage_totals": "3d1b76c39bfb2cc8296b024d73854724", - "application_usage_transactional": "3d1b76c39bfb2cc8296b024d73854724", - "canvas-element": "7390014e1091044523666d97247392fc", - "canvas-workpad": "b0a1706d356228dbdcb4a17e6b9eb231", - "canvas-workpad-template": "ae2673f678281e2c055d764b153e9715", - "cases": "7c28a18fbac7c2a4e79449e9802ef476", - "cases-comments": "112cefc2b6737e613a8ef033234755e6", - "cases-configure": "387c5f3a3bda7e0ae0dd4e106f914a69", - "cases-connector-mappings": "6bc7e49411d38be4969dc6aa8bd43776", - "cases-sub-case": "2dc9dbf1fc7144e2b18fffc017358ff9", - "cases-user-actions": "32277330ec6b721abe3b846cfd939a71", - "config": "c63748b75f39d0c54de12d12c1ccbc20", - "core-usage-stats": "3d1b76c39bfb2cc8296b024d73854724", - "coreMigrationVersion": "2f4316de49999235636386fe51dc06c1", - "dashboard": "40554caf09725935e2c02e02563a2d07", - "endpoint:user-artifact": "4a11183eee21e6fbad864f7a30b39ad0", - "endpoint:user-artifact-manifest": "a0d7b04ad405eed54d76e279c3727862", - "enterprise_search_telemetry": "3d1b76c39bfb2cc8296b024d73854724", - "epm-packages": "0cbbb16506734d341a96aaed65ec6413", - "epm-packages-assets": "44621b2f6052ef966da47b7c3a00f33b", - "exception-list": "baf108c9934dda844921f692a513adae", - "exception-list-agnostic": "baf108c9934dda844921f692a513adae", - "file-upload-usage-collection-telemetry": "a34fbb8e3263d105044869264860c697", - "fleet-agent-actions": "9511b565b1cc6441a42033db3d5de8e9", - "fleet-agent-events": "e20a508b6e805189356be381dbfac8db", - "fleet-agents": "59fd74f819f028f8555776db198d2562", - "fleet-enrollment-api-keys": "a69ef7ae661dab31561d6c6f052ef2a7", - "graph-workspace": "27a94b2edcb0610c6aea54a7c56d7752", - "index-pattern": "45915a1ad866812242df474eb0479052", - "infrastructure-ui-source": "3d1b76c39bfb2cc8296b024d73854724", - "ingest-agent-policies": "8df93787e2927f227dc80db8b6d309b9", - "ingest-outputs": "8854f34453a47e26f86a29f8f3b80b4e", - "ingest-package-policies": "c91ca97b1ff700f0fc64dc6b13d65a85", - "ingest_manager_settings": "22d4d1288c2687ef6a8f6e83159b4542", - "inventory-view": "3d1b76c39bfb2cc8296b024d73854724", - "kql-telemetry": "d12a98a6f19a2d273696597547e064ee", - "legacy-url-alias": "3d1b76c39bfb2cc8296b024d73854724", - "lens": "52346cfec69ff7b47d5f0c12361a2797", - "lens-ui-telemetry": "509bfa5978586998e05f9e303c07a327", - "map": "9134b47593116d7953f6adba096fc463", - "maps-telemetry": "5ef305b18111b77789afefbd36b66171", - "metrics-explorer-view": "3d1b76c39bfb2cc8296b024d73854724", - "migrationVersion": "4a1746014a75ade3a714e1db5763276f", - "ml-job": "3bb64c31915acf93fc724af137a0891b", - "ml-module": "46ef4f0d6682636f0fff9799d6a2d7ac", - "monitoring-telemetry": "2669d5ec15e82391cf58df4294ee9c68", - "namespace": "2f4316de49999235636386fe51dc06c1", - "namespaces": "2f4316de49999235636386fe51dc06c1", - "originId": "2f4316de49999235636386fe51dc06c1", - "query": "11aaeb7f5f7fa5bb43f25e18ce26e7d9", - "references": "7997cf5a56cc02bdc9c93361bde732b0", - "sample-data-telemetry": "7d3cfeb915303c9641c59681967ffeb4", - "search": "db2c00e39b36f40930a3b9fc71c823e1", - "search-session": "33157cf0119e41cd4e7a1d24266beff4", - "search-telemetry": "3d1b76c39bfb2cc8296b024d73854724", - "security-solution-signals-migration": "72761fd374ca11122ac8025a92b84fca", - "siem-detection-engine-rule-actions": "6569b288c169539db10cb262bf79de18", - "siem-detection-engine-rule-status": "ae783f41c6937db6b7a2ef5c93a9e9b0", - "siem-ui-timeline": "3e97beae13cdfc6d62bc1846119f7276", - "siem-ui-timeline-note": "8874706eedc49059d4cf0f5094559084", - "siem-ui-timeline-pinned-event": "20638091112f0e14f0e443d512301c29", - "space": "c5ca8acafa0beaa4d08d014a97b6bc6b", - "spaces-usage-stats": "3d1b76c39bfb2cc8296b024d73854724", - "tag": "83d55da58f6530f7055415717ec06474", - "telemetry": "36a616f7026dfa617d6655df850fe16d", - "timelion-sheet": "9a2a2748877c7a7b582fef201ab1d4cf", - "type": "2f4316de49999235636386fe51dc06c1", - "ui-counter": "0d409297dc5ebe1e3a1da691c6ee32e3", - "ui-metric": "0d409297dc5ebe1e3a1da691c6ee32e3", - "updated_at": "00da57df13e94e9d98437d13ace4bfe0", - "upgrade-assistant-reindex-operation": "215107c281839ea9b3ad5f6419819763", - "upgrade-assistant-telemetry": "56702cec857e0a9dacfb696655b4ff7b", - "uptime-dynamic-settings": "3d1b76c39bfb2cc8296b024d73854724", - "url": "c7f66a0df8b1b52f17c28c4adb111105", - "visualization": "f819cf6636b75c9e76ba733a0c6ef355", - "workplace_search_telemetry": "3d1b76c39bfb2cc8296b024d73854724" - } - }, - "dynamic": "strict", - "properties": { - "action": { - "properties": { - "actionTypeId": { - "type": "keyword" - }, - "config": { - "enabled": false, - "type": "object" - }, - "name": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - }, - "secrets": { - "type": "binary" - } - } - }, - "action_task_params": { - "properties": { - "actionId": { - "type": "keyword" - }, - "apiKey": { - "type": "binary" - }, - "params": { - "enabled": false, - "type": "object" - } - } - }, - "alert": { - "properties": { - "actions": { - "properties": { - "actionRef": { - "type": "keyword" - }, - "actionTypeId": { - "type": "keyword" - }, - "group": { - "type": "keyword" - }, - "params": { - "enabled": false, - "type": "object" - } - }, - "type": "nested" - }, - "alertTypeId": { - "type": "keyword" - }, - "apiKey": { - "type": "binary" - }, - "apiKeyOwner": { - "type": "keyword" - }, - "consumer": { - "type": "keyword" - }, - "createdAt": { - "type": "date" - }, - "createdBy": { - "type": "keyword" - }, - "enabled": { - "type": "boolean" - }, - "executionStatus": { - "properties": { - "error": { - "properties": { - "message": { - "type": "keyword" - }, - "reason": { - "type": "keyword" - } - } - }, - "lastExecutionDate": { - "type": "date" - }, - "status": { - "type": "keyword" - } - } - }, - "meta": { - "properties": { - "versionApiKeyLastmodified": { - "type": "keyword" - } - } - }, - "muteAll": { - "type": "boolean" - }, - "mutedInstanceIds": { - "type": "keyword" - }, - "name": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - }, - "notifyWhen": { - "type": "keyword" - }, - "params": { - "type": "flattened" - }, - "schedule": { - "properties": { - "interval": { - "type": "keyword" - } - } - }, - "scheduledTaskId": { - "type": "keyword" - }, - "tags": { - "type": "keyword" - }, - "throttle": { - "type": "keyword" - }, - "updatedAt": { - "type": "date" - }, - "updatedBy": { - "type": "keyword" - } - } - }, - "api_key_pending_invalidation": { - "properties": { - "apiKeyId": { - "type": "keyword" - }, - "createdAt": { - "type": "date" - } - } - }, - "apm-indices": { - "properties": { - "apm_oss": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } - }, - "apm-telemetry": { - "dynamic": "false", - "type": "object" - }, - "app_search_telemetry": { - "dynamic": "false", - "type": "object" - }, - "application_usage_daily": { - "dynamic": "false", - "properties": { - "timestamp": { - "type": "date" - } - } - }, - "application_usage_totals": { - "dynamic": "false", - "type": "object" - }, - "application_usage_transactional": { - "dynamic": "false", - "type": "object" - }, - "canvas-element": { - "dynamic": "false", - "properties": { - "@created": { - "type": "date" - }, - "@timestamp": { - "type": "date" - }, - "content": { - "type": "text" - }, - "help": { - "type": "text" - }, - "image": { - "type": "text" - }, - "name": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "canvas-workpad": { - "dynamic": "false", - "properties": { - "@created": { - "type": "date" - }, - "@timestamp": { - "type": "date" - }, - "name": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "canvas-workpad-template": { - "dynamic": "false", - "properties": { - "help": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - }, - "name": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - }, - "tags": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - }, - "template_key": { - "type": "keyword" - } - } - }, - "cases": { - "properties": { - "closed_at": { - "type": "date" - }, - "closed_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - }, - "connector": { - "properties": { - "fields": { - "properties": { - "key": { - "type": "text" - }, - "value": { - "type": "text" - } - } - }, - "id": { - "type": "keyword" - }, - "name": { - "type": "text" - }, - "type": { - "type": "keyword" - } - } - }, - "created_at": { - "type": "date" - }, - "created_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - }, - "description": { - "type": "text" - }, - "external_service": { - "properties": { - "connector_id": { - "type": "keyword" - }, - "connector_name": { - "type": "keyword" - }, - "external_id": { - "type": "keyword" - }, - "external_title": { - "type": "text" - }, - "external_url": { - "type": "text" - }, - "pushed_at": { - "type": "date" - }, - "pushed_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - } - } - }, - "settings": { - "properties": { - "syncAlerts": { - "type": "boolean" - } - } - }, - "status": { - "type": "keyword" - }, - "tags": { - "type": "keyword" - }, - "title": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "updated_at": { - "type": "date" - }, - "updated_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - } - } - }, - "cases-comments": { - "properties": { - "alertId": { - "type": "keyword" - }, - "associationType": { - "type": "keyword" - }, - "comment": { - "type": "text" - }, - "created_at": { - "type": "date" - }, - "created_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - }, - "index": { - "type": "keyword" - }, - "pushed_at": { - "type": "date" - }, - "pushed_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - }, - "rule": { - "properties": { - "id": { - "type": "keyword" - }, - "name": { - "type": "keyword" - } - } - }, - "type": { - "type": "keyword" - }, - "updated_at": { - "type": "date" - }, - "updated_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - } - } - }, - "cases-configure": { - "properties": { - "closure_type": { - "type": "keyword" - }, - "connector": { - "properties": { - "fields": { - "properties": { - "key": { - "type": "text" - }, - "value": { - "type": "text" - } - } - }, - "id": { - "type": "keyword" - }, - "name": { - "type": "text" - }, - "type": { - "type": "keyword" - } - } - }, - "created_at": { - "type": "date" - }, - "created_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - }, - "updated_at": { - "type": "date" - }, - "updated_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - } - } - }, - "cases-connector-mappings": { - "properties": { - "mappings": { - "properties": { - "action_type": { - "type": "keyword" - }, - "source": { - "type": "keyword" - }, - "target": { - "type": "keyword" - } - } - } - } - }, - "cases-sub-case": { - "properties": { - "closed_at": { - "type": "date" - }, - "closed_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - }, - "created_at": { - "type": "date" - }, - "created_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - }, - "status": { - "type": "keyword" - }, - "updated_at": { - "type": "date" - }, - "updated_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - } - } - }, - "cases-user-actions": { - "properties": { - "action": { - "type": "keyword" - }, - "action_at": { - "type": "date" - }, - "action_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - }, - "action_field": { - "type": "keyword" - }, - "new_value": { - "type": "text" - }, - "old_value": { - "type": "text" - } - } - }, - "config": { - "dynamic": "false", - "properties": { - "buildNum": { - "type": "keyword" - } - } - }, - "core-usage-stats": { - "dynamic": "false", - "type": "object" - }, - "coreMigrationVersion": { - "type": "keyword" - }, - "dashboard": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "doc_values": false, - "index": false, - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "index": false, - "type": "text" - } - } - }, - "optionsJSON": { - "index": false, - "type": "text" - }, - "panelsJSON": { - "index": false, - "type": "text" - }, - "refreshInterval": { - "properties": { - "display": { - "doc_values": false, - "index": false, - "type": "keyword" - }, - "pause": { - "doc_values": false, - "index": false, - "type": "boolean" - }, - "section": { - "doc_values": false, - "index": false, - "type": "integer" - }, - "value": { - "doc_values": false, - "index": false, - "type": "integer" - } - } - }, - "timeFrom": { - "doc_values": false, - "index": false, - "type": "keyword" - }, - "timeRestore": { - "doc_values": false, - "index": false, - "type": "boolean" - }, - "timeTo": { - "doc_values": false, - "index": false, - "type": "keyword" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "endpoint:user-artifact": { - "properties": { - "body": { - "type": "binary" - }, - "compressionAlgorithm": { - "index": false, - "type": "keyword" - }, - "created": { - "index": false, - "type": "date" - }, - "decodedSha256": { - "index": false, - "type": "keyword" - }, - "decodedSize": { - "index": false, - "type": "long" - }, - "encodedSha256": { - "type": "keyword" - }, - "encodedSize": { - "index": false, - "type": "long" - }, - "encryptionAlgorithm": { - "index": false, - "type": "keyword" - }, - "identifier": { - "type": "keyword" - } - } - }, - "endpoint:user-artifact-manifest": { - "properties": { - "artifacts": { - "properties": { - "artifactId": { - "index": false, - "type": "keyword" - }, - "policyId": { - "index": false, - "type": "keyword" - } - }, - "type": "nested" - }, - "created": { - "index": false, - "type": "date" - }, - "schemaVersion": { - "type": "keyword" - }, - "semanticVersion": { - "index": false, - "type": "keyword" - } - } - }, - "enterprise_search_telemetry": { - "dynamic": "false", - "type": "object" - }, - "epm-packages": { - "properties": { - "es_index_patterns": { - "enabled": false, - "type": "object" - }, - "install_source": { - "type": "keyword" - }, - "install_started_at": { - "type": "date" - }, - "install_status": { - "type": "keyword" - }, - "install_version": { - "type": "keyword" - }, - "installed_es": { - "properties": { - "id": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - }, - "type": "nested" - }, - "installed_kibana": { - "properties": { - "id": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - }, - "type": "nested" - }, - "internal": { - "type": "boolean" - }, - "name": { - "type": "keyword" - }, - "package_assets": { - "properties": { - "id": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - }, - "type": "nested" - }, - "removable": { - "type": "boolean" - }, - "version": { - "type": "keyword" - } - } - }, - "epm-packages-assets": { - "properties": { - "asset_path": { - "type": "keyword" - }, - "data_base64": { - "type": "binary" - }, - "data_utf8": { - "index": false, - "type": "text" - }, - "install_source": { - "type": "keyword" - }, - "media_type": { - "type": "keyword" - }, - "package_name": { - "type": "keyword" - }, - "package_version": { - "type": "keyword" - } - } - }, - "exception-list": { - "properties": { - "_tags": { - "type": "keyword" - }, - "comments": { - "properties": { - "comment": { - "type": "keyword" - }, - "created_at": { - "type": "keyword" - }, - "created_by": { - "type": "keyword" - }, - "id": { - "type": "keyword" - }, - "updated_at": { - "type": "keyword" - }, - "updated_by": { - "type": "keyword" - } - } - }, - "created_at": { - "type": "keyword" - }, - "created_by": { - "type": "keyword" - }, - "description": { - "type": "keyword" - }, - "entries": { - "properties": { - "entries": { - "properties": { - "field": { - "type": "keyword" - }, - "operator": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "value": { - "fields": { - "text": { - "type": "text" - } - }, - "type": "keyword" - } - } - }, - "field": { - "type": "keyword" - }, - "list": { - "properties": { - "id": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - } - }, - "operator": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "value": { - "fields": { - "text": { - "type": "text" - } - }, - "type": "keyword" - } - } - }, - "immutable": { - "type": "boolean" - }, - "item_id": { - "type": "keyword" - }, - "list_id": { - "type": "keyword" - }, - "list_type": { - "type": "keyword" - }, - "meta": { - "type": "keyword" - }, - "name": { - "fields": { - "text": { - "type": "text" - } - }, - "type": "keyword" - }, - "os_types": { - "type": "keyword" - }, - "tags": { - "fields": { - "text": { - "type": "text" - } - }, - "type": "keyword" - }, - "tie_breaker_id": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "updated_by": { - "type": "keyword" - }, - "version": { - "type": "keyword" - } - } - }, - "exception-list-agnostic": { - "properties": { - "_tags": { - "type": "keyword" - }, - "comments": { - "properties": { - "comment": { - "type": "keyword" - }, - "created_at": { - "type": "keyword" - }, - "created_by": { - "type": "keyword" - }, - "id": { - "type": "keyword" - }, - "updated_at": { - "type": "keyword" - }, - "updated_by": { - "type": "keyword" - } - } - }, - "created_at": { - "type": "keyword" - }, - "created_by": { - "type": "keyword" - }, - "description": { - "type": "keyword" - }, - "entries": { - "properties": { - "entries": { - "properties": { - "field": { - "type": "keyword" - }, - "operator": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "value": { - "fields": { - "text": { - "type": "text" - } - }, - "type": "keyword" - } - } - }, - "field": { - "type": "keyword" - }, - "list": { - "properties": { - "id": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - } - }, - "operator": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "value": { - "fields": { - "text": { - "type": "text" - } - }, - "type": "keyword" - } - } - }, - "immutable": { - "type": "boolean" - }, - "item_id": { - "type": "keyword" - }, - "list_id": { - "type": "keyword" - }, - "list_type": { - "type": "keyword" - }, - "meta": { - "type": "keyword" - }, - "name": { - "fields": { - "text": { - "type": "text" - } - }, - "type": "keyword" - }, - "os_types": { - "type": "keyword" - }, - "tags": { - "fields": { - "text": { - "type": "text" - } - }, - "type": "keyword" - }, - "tie_breaker_id": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "updated_by": { - "type": "keyword" - }, - "version": { - "type": "keyword" - } - } - }, - "file-upload-usage-collection-telemetry": { - "properties": { - "file_upload": { - "properties": { - "index_creation_count": { - "type": "long" - } - } - } - } - }, - "fleet-agent-actions": { - "properties": { - "ack_data": { - "type": "text" - }, - "agent_id": { - "type": "keyword" - }, - "created_at": { - "type": "date" - }, - "data": { - "type": "binary" - }, - "policy_id": { - "type": "keyword" - }, - "policy_revision": { - "type": "integer" - }, - "sent_at": { - "type": "date" - }, - "type": { - "type": "keyword" - } - } - }, - "fleet-agent-events": { - "properties": { - "action_id": { - "type": "keyword" - }, - "agent_id": { - "type": "keyword" - }, - "data": { - "type": "text" - }, - "message": { - "type": "text" - }, - "payload": { - "type": "text" - }, - "policy_id": { - "type": "keyword" - }, - "stream_id": { - "type": "keyword" - }, - "subtype": { - "type": "keyword" - }, - "timestamp": { - "type": "date" - }, - "type": { - "type": "keyword" - } - } - }, - "fleet-agents": { - "properties": { - "access_api_key_id": { - "type": "keyword" - }, - "active": { - "type": "boolean" - }, - "current_error_events": { - "index": false, - "type": "text" - }, - "default_api_key": { - "type": "binary" - }, - "default_api_key_id": { - "type": "keyword" - }, - "enrolled_at": { - "type": "date" - }, - "last_checkin": { - "type": "date" - }, - "last_checkin_status": { - "type": "keyword" - }, - "last_updated": { - "type": "date" - }, - "local_metadata": { - "type": "flattened" - }, - "packages": { - "type": "keyword" - }, - "policy_id": { - "type": "keyword" - }, - "policy_revision": { - "type": "integer" - }, - "type": { - "type": "keyword" - }, - "unenrolled_at": { - "type": "date" - }, - "unenrollment_started_at": { - "type": "date" - }, - "updated_at": { - "type": "date" - }, - "upgrade_started_at": { - "type": "date" - }, - "upgraded_at": { - "type": "date" - }, - "user_provided_metadata": { - "type": "flattened" - }, - "version": { - "type": "keyword" - } - } - }, - "fleet-enrollment-api-keys": { - "properties": { - "active": { - "type": "boolean" - }, - "api_key": { - "type": "binary" - }, - "api_key_id": { - "type": "keyword" - }, - "created_at": { - "type": "date" - }, - "expire_at": { - "type": "date" - }, - "name": { - "type": "keyword" - }, - "policy_id": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "updated_at": { - "type": "date" - } - } - }, - "graph-workspace": { - "properties": { - "description": { - "type": "text" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "legacyIndexPatternRef": { - "index": false, - "type": "text" - }, - "numLinks": { - "type": "integer" - }, - "numVertices": { - "type": "integer" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - }, - "wsState": { - "type": "text" - } - } - }, - "index-pattern": { - "dynamic": "false", - "properties": { - "title": { - "type": "text" - }, - "type": { - "type": "keyword" - } - } - }, - "infrastructure-ui-source": { - "dynamic": "false", - "type": "object" - }, - "ingest-agent-policies": { - "properties": { - "description": { - "type": "text" - }, - "is_default": { - "type": "boolean" - }, - "is_default_fleet_server": { - "type": "boolean" - }, - "is_managed": { - "type": "boolean" - }, - "monitoring_enabled": { - "index": false, - "type": "keyword" - }, - "name": { - "type": "keyword" - }, - "namespace": { - "type": "keyword" - }, - "package_policies": { - "type": "keyword" - }, - "revision": { - "type": "integer" - }, - "status": { - "type": "keyword" - }, - "updated_at": { - "type": "date" - }, - "updated_by": { - "type": "keyword" - } - } - }, - "ingest-outputs": { - "properties": { - "ca_sha256": { - "index": false, - "type": "keyword" - }, - "config": { - "type": "flattened" - }, - "config_yaml": { - "type": "text" - }, - "fleet_enroll_password": { - "type": "binary" - }, - "fleet_enroll_username": { - "type": "binary" - }, - "hosts": { - "type": "keyword" - }, - "is_default": { - "type": "boolean" - }, - "name": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - } - }, - "ingest-package-policies": { - "properties": { - "created_at": { - "type": "date" - }, - "created_by": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "enabled": { - "type": "boolean" - }, - "inputs": { - "enabled": false, - "properties": { - "compiled_input": { - "type": "flattened" - }, - "config": { - "type": "flattened" - }, - "enabled": { - "type": "boolean" - }, - "streams": { - "properties": { - "compiled_stream": { - "type": "flattened" - }, - "config": { - "type": "flattened" - }, - "data_stream": { - "properties": { - "dataset": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - } - }, - "enabled": { - "type": "boolean" - }, - "id": { - "type": "keyword" - }, - "vars": { - "type": "flattened" - } - }, - "type": "nested" - }, - "type": { - "type": "keyword" - }, - "vars": { - "type": "flattened" - } - }, - "type": "nested" - }, - "name": { - "type": "keyword" - }, - "namespace": { - "type": "keyword" - }, - "output_id": { - "type": "keyword" - }, - "package": { - "properties": { - "name": { - "type": "keyword" - }, - "title": { - "type": "keyword" - }, - "version": { - "type": "keyword" - } - } - }, - "policy_id": { - "type": "keyword" - }, - "revision": { - "type": "integer" - }, - "updated_at": { - "type": "date" - }, - "updated_by": { - "type": "keyword" - } - } - }, - "ingest_manager_settings": { - "properties": { - "has_seen_add_data_notice": { - "index": false, - "type": "boolean" - }, - "kibana_ca_sha256": { - "type": "keyword" - }, - "kibana_urls": { - "type": "keyword" - } - } - }, - "inventory-view": { - "dynamic": "false", - "type": "object" - }, - "kql-telemetry": { - "properties": { - "optInCount": { - "type": "long" - }, - "optOutCount": { - "type": "long" - } - } - }, - "legacy-url-alias": { - "dynamic": "false", - "type": "object" - }, - "lens": { - "properties": { - "description": { - "type": "text" - }, - "expression": { - "doc_values": false, - "index": false, - "type": "keyword" - }, - "state": { - "type": "flattened" - }, - "title": { - "type": "text" - }, - "visualizationType": { - "type": "keyword" - } - } - }, - "lens-ui-telemetry": { - "properties": { - "count": { - "type": "integer" - }, - "date": { - "type": "date" - }, - "name": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - } - }, - "map": { - "properties": { - "bounds": { - "dynamic": "false", - "type": "object" - }, - "description": { - "type": "text" - }, - "layerListJSON": { - "type": "text" - }, - "mapStateJSON": { - "type": "text" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "maps-telemetry": { - "enabled": false, - "type": "object" - }, - "metrics-explorer-view": { - "dynamic": "false", - "type": "object" - }, - "migrationVersion": { - "dynamic": "true", - "properties": { - "config": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "dashboard": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "index-pattern": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "visualization": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "ml-job": { - "properties": { - "datafeed_id": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - }, - "job_id": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - }, - "type": { - "type": "keyword" - } - } - }, - "ml-module": { - "dynamic": "false", - "properties": { - "datafeeds": { - "type": "object" - }, - "defaultIndexPattern": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - }, - "description": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - }, - "id": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - }, - "jobs": { - "type": "object" - }, - "logo": { - "type": "object" - }, - "query": { - "type": "object" - }, - "title": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - }, - "type": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "monitoring-telemetry": { - "properties": { - "reportedClusterUuids": { - "type": "keyword" - } - } - }, - "namespace": { - "type": "keyword" - }, - "namespaces": { - "type": "keyword" - }, - "originId": { - "type": "keyword" - }, - "query": { - "properties": { - "description": { - "type": "text" - }, - "filters": { - "enabled": false, - "type": "object" - }, - "query": { - "properties": { - "language": { - "type": "keyword" - }, - "query": { - "index": false, - "type": "keyword" - } - } - }, - "timefilter": { - "enabled": false, - "type": "object" - }, - "title": { - "type": "text" - } - } - }, - "references": { - "properties": { - "id": { - "type": "keyword" - }, - "name": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - }, - "type": "nested" - }, - "sample-data-telemetry": { - "properties": { - "installCount": { - "type": "long" - }, - "unInstallCount": { - "type": "long" - } - } - }, - "search": { - "properties": { - "columns": { - "doc_values": false, - "index": false, - "type": "keyword" - }, - "description": { - "type": "text" - }, - "grid": { - "enabled": false, - "type": "object" - }, - "hideChart": { - "doc_values": false, - "index": false, - "type": "boolean" - }, - "hits": { - "doc_values": false, - "index": false, - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "index": false, - "type": "text" - } - } - }, - "sort": { - "doc_values": false, - "index": false, - "type": "keyword" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "search-session": { - "properties": { - "appId": { - "type": "keyword" - }, - "created": { - "type": "date" - }, - "expires": { - "type": "date" - }, - "idMapping": { - "enabled": false, - "type": "object" - }, - "initialState": { - "enabled": false, - "type": "object" - }, - "name": { - "type": "keyword" - }, - "persisted": { - "type": "boolean" - }, - "realmName": { - "type": "keyword" - }, - "realmType": { - "type": "keyword" - }, - "restoreState": { - "enabled": false, - "type": "object" - }, - "sessionId": { - "type": "keyword" - }, - "status": { - "type": "keyword" - }, - "touched": { - "type": "date" - }, - "urlGeneratorId": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - }, - "search-telemetry": { - "dynamic": "false", - "type": "object" - }, - "security-solution-signals-migration": { - "properties": { - "created": { - "index": false, - "type": "date" - }, - "createdBy": { - "index": false, - "type": "text" - }, - "destinationIndex": { - "index": false, - "type": "keyword" - }, - "error": { - "index": false, - "type": "text" - }, - "sourceIndex": { - "type": "keyword" - }, - "status": { - "index": false, - "type": "keyword" - }, - "taskId": { - "index": false, - "type": "keyword" - }, - "updated": { - "index": false, - "type": "date" - }, - "updatedBy": { - "index": false, - "type": "text" - }, - "version": { - "type": "long" - } - } - }, - "server": { - "dynamic": "false", - "type": "object" - }, - "siem-detection-engine-rule-actions": { - "properties": { - "actions": { - "properties": { - "action_type_id": { - "type": "keyword" - }, - "group": { - "type": "keyword" - }, - "id": { - "type": "keyword" - }, - "params": { - "enabled": false, - "type": "object" - } - } - }, - "alertThrottle": { - "type": "keyword" - }, - "ruleAlertId": { - "type": "keyword" - }, - "ruleThrottle": { - "type": "keyword" - } - } - }, - "siem-detection-engine-rule-status": { - "properties": { - "alertId": { - "type": "keyword" - }, - "bulkCreateTimeDurations": { - "type": "float" - }, - "gap": { - "type": "text" - }, - "lastFailureAt": { - "type": "date" - }, - "lastFailureMessage": { - "type": "text" - }, - "lastLookBackDate": { - "type": "date" - }, - "lastSuccessAt": { - "type": "date" - }, - "lastSuccessMessage": { - "type": "text" - }, - "searchAfterTimeDurations": { - "type": "float" - }, - "status": { - "type": "keyword" - }, - "statusDate": { - "type": "date" - } - } - }, - "siem-ui-timeline": { - "properties": { - "columns": { - "properties": { - "aggregatable": { - "type": "boolean" - }, - "category": { - "type": "keyword" - }, - "columnHeaderType": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "example": { - "type": "text" - }, - "id": { - "type": "keyword" - }, - "indexes": { - "type": "keyword" - }, - "name": { - "type": "text" - }, - "placeholder": { - "type": "text" - }, - "searchable": { - "type": "boolean" - }, - "type": { - "type": "keyword" - } - } - }, - "created": { - "type": "date" - }, - "createdBy": { - "type": "text" - }, - "dataProviders": { - "properties": { - "and": { - "properties": { - "enabled": { - "type": "boolean" - }, - "excluded": { - "type": "boolean" - }, - "id": { - "type": "keyword" - }, - "kqlQuery": { - "type": "text" - }, - "name": { - "type": "text" - }, - "queryMatch": { - "properties": { - "displayField": { - "type": "text" - }, - "displayValue": { - "type": "text" - }, - "field": { - "type": "text" - }, - "operator": { - "type": "text" - }, - "value": { - "type": "text" - } - } - }, - "type": { - "type": "text" - } - } - }, - "enabled": { - "type": "boolean" - }, - "excluded": { - "type": "boolean" - }, - "id": { - "type": "keyword" - }, - "kqlQuery": { - "type": "text" - }, - "name": { - "type": "text" - }, - "queryMatch": { - "properties": { - "displayField": { - "type": "text" - }, - "displayValue": { - "type": "text" - }, - "field": { - "type": "text" - }, - "operator": { - "type": "text" - }, - "value": { - "type": "text" - } - } - }, - "type": { - "type": "text" - } - } - }, - "dateRange": { - "properties": { - "end": { - "type": "date" - }, - "start": { - "type": "date" - } - } - }, - "description": { - "type": "text" - }, - "eqlOptions": { - "properties": { - "eventCategoryField": { - "type": "text" - }, - "query": { - "type": "text" - }, - "size": { - "type": "text" - }, - "tiebreakerField": { - "type": "text" - }, - "timestampField": { - "type": "text" - } - } - }, - "eventType": { - "type": "keyword" - }, - "excludedRowRendererIds": { - "type": "text" - }, - "favorite": { - "properties": { - "favoriteDate": { - "type": "date" - }, - "fullName": { - "type": "text" - }, - "keySearch": { - "type": "text" - }, - "userName": { - "type": "text" - } - } - }, - "filters": { - "properties": { - "exists": { - "type": "text" - }, - "match_all": { - "type": "text" - }, - "meta": { - "properties": { - "alias": { - "type": "text" - }, - "controlledBy": { - "type": "text" - }, - "disabled": { - "type": "boolean" - }, - "field": { - "type": "text" - }, - "formattedValue": { - "type": "text" - }, - "index": { - "type": "keyword" - }, - "key": { - "type": "keyword" - }, - "negate": { - "type": "boolean" - }, - "params": { - "type": "text" - }, - "type": { - "type": "keyword" - }, - "value": { - "type": "text" - } - } - }, - "missing": { - "type": "text" - }, - "query": { - "type": "text" - }, - "range": { - "type": "text" - }, - "script": { - "type": "text" - } - } - }, - "indexNames": { - "type": "text" - }, - "kqlMode": { - "type": "keyword" - }, - "kqlQuery": { - "properties": { - "filterQuery": { - "properties": { - "kuery": { - "properties": { - "expression": { - "type": "text" - }, - "kind": { - "type": "keyword" - } - } - }, - "serializedQuery": { - "type": "text" - } - } - } - } - }, - "savedQueryId": { - "type": "keyword" - }, - "sort": { - "dynamic": "false", - "properties": { - "columnId": { - "type": "keyword" - }, - "columnType": { - "type": "keyword" - }, - "sortDirection": { - "type": "keyword" - } - } - }, - "status": { - "type": "keyword" - }, - "templateTimelineId": { - "type": "text" - }, - "templateTimelineVersion": { - "type": "integer" - }, - "timelineType": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "updated": { - "type": "date" - }, - "updatedBy": { - "type": "text" - } - } - }, - "siem-ui-timeline-note": { - "properties": { - "created": { - "type": "date" - }, - "createdBy": { - "type": "text" - }, - "eventId": { - "type": "keyword" - }, - "note": { - "type": "text" - }, - "timelineId": { - "type": "keyword" - }, - "updated": { - "type": "date" - }, - "updatedBy": { - "type": "text" - } - } - }, - "siem-ui-timeline-pinned-event": { - "properties": { - "created": { - "type": "date" - }, - "createdBy": { - "type": "text" - }, - "eventId": { - "type": "keyword" - }, - "timelineId": { - "type": "keyword" - }, - "updated": { - "type": "date" - }, - "updatedBy": { - "type": "text" - } - } - }, - "space": { - "properties": { - "_reserved": { - "type": "boolean" - }, - "color": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "disabledFeatures": { - "type": "keyword" - }, - "imageUrl": { - "index": false, - "type": "text" - }, - "initials": { - "type": "keyword" - }, - "name": { - "fields": { - "keyword": { - "ignore_above": 2048, - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "spaces-usage-stats": { - "dynamic": "false", - "type": "object" - }, - "tag": { - "properties": { - "color": { - "type": "text" - }, - "description": { - "type": "text" - }, - "name": { - "type": "text" - } - } - }, - "telemetry": { - "properties": { - "allowChangingOptInStatus": { - "type": "boolean" - }, - "enabled": { - "type": "boolean" - }, - "lastReported": { - "type": "date" - }, - "lastVersionChecked": { - "type": "keyword" - }, - "reportFailureCount": { - "type": "integer" - }, - "reportFailureVersion": { - "type": "keyword" - }, - "sendUsageFrom": { - "type": "keyword" - }, - "userHasSeenNotice": { - "type": "boolean" - } - } - }, - "timelion-sheet": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timelion_chart_height": { - "type": "integer" - }, - "timelion_columns": { - "type": "integer" - }, - "timelion_interval": { - "type": "keyword" - }, - "timelion_other_interval": { - "type": "keyword" - }, - "timelion_rows": { - "type": "integer" - }, - "timelion_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "type": { - "type": "keyword" - }, - "ui-counter": { - "properties": { - "count": { - "type": "integer" - } - } - }, - "ui-metric": { - "properties": { - "count": { - "type": "integer" - } - } - }, - "updated_at": { - "type": "date" - }, - "upgrade-assistant-reindex-operation": { - "properties": { - "errorMessage": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "indexName": { - "type": "keyword" - }, - "lastCompletedStep": { - "type": "long" - }, - "locked": { - "type": "date" - }, - "newIndexName": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "reindexOptions": { - "properties": { - "openAndClose": { - "type": "boolean" - }, - "queueSettings": { - "properties": { - "queuedAt": { - "type": "long" - }, - "startedAt": { - "type": "long" - } - } - } - } - }, - "reindexTaskId": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "reindexTaskPercComplete": { - "type": "float" - }, - "runningReindexCount": { - "type": "integer" - }, - "status": { - "type": "integer" - } - } - }, - "upgrade-assistant-telemetry": { - "properties": { - "features": { - "properties": { - "deprecation_logging": { - "properties": { - "enabled": { - "null_value": true, - "type": "boolean" - } - } - } - } - }, - "ui_open": { - "properties": { - "cluster": { - "null_value": 0, - "type": "long" - }, - "indices": { - "null_value": 0, - "type": "long" - }, - "overview": { - "null_value": 0, - "type": "long" - } - } - }, - "ui_reindex": { - "properties": { - "close": { - "null_value": 0, - "type": "long" - }, - "open": { - "null_value": 0, - "type": "long" - }, - "start": { - "null_value": 0, - "type": "long" - }, - "stop": { - "null_value": 0, - "type": "long" - } - } - } - } - }, - "uptime-dynamic-settings": { - "dynamic": "false", - "type": "object" - }, - "url": { - "properties": { - "accessCount": { - "type": "long" - }, - "accessDate": { - "type": "date" - }, - "createDate": { - "type": "date" - }, - "url": { - "fields": { - "keyword": { - "ignore_above": 2048, - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "visualization": { - "properties": { - "description": { - "type": "text" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "index": false, - "type": "text" - } - } - }, - "savedSearchRefName": { - "doc_values": false, - "index": false, - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "index": false, - "type": "text" - }, - "version": { - "type": "integer" - }, - "visState": { - "index": false, - "type": "text" - } - } - }, - "workplace_search_telemetry": { - "dynamic": "false", - "type": "object" - } - } - }, - "settings": { - "index": { - "number_of_replicas": "0", - "number_of_shards": "1" - } - } - } -} \ No newline at end of file diff --git a/test/api_integration/fixtures/es_archiver/saved_objects/find_edgecases/data.json b/test/api_integration/fixtures/es_archiver/saved_objects/find_edgecases/data.json deleted file mode 100644 index 0c8b35fd3f49944..000000000000000 --- a/test/api_integration/fixtures/es_archiver/saved_objects/find_edgecases/data.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "type": "doc", - "value": { - "index": ".kibana", - "id": "visualization:title-with-dash", - "source": { - "type": "visualization", - "updated_at": "2017-09-21T18:51:23.794Z", - "visualization": { - "title": "my-visualization", - "visState": "{}", - "uiStateJSON": "{\"spy\":{\"mode\":{\"name\":null,\"fill\":false}}}", - "description": "", - "version": 1, - "kibanaSavedObjectMeta": { - "searchSourceJSON": "{\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"}}" - } - }, - "references": [] - } - } -} - -{ - "type": "doc", - "value": { - "index": ".kibana", - "id": "visualization:title-with-asterisk", - "source": { - "type": "visualization", - "updated_at": "2017-09-21T18:51:23.794Z", - "visualization": { - "title": "some*visualization", - "visState": "{}", - "uiStateJSON": "{\"spy\":{\"mode\":{\"name\":null,\"fill\":false}}}", - "description": "", - "version": 1, - "kibanaSavedObjectMeta": { - "searchSourceJSON": "{\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"}}" - } - }, - "references": [] - } - } -} - - -{ - "type": "doc", - "value": { - "index": ".kibana", - "id": "visualization:noise-1", - "source": { - "type": "visualization", - "updated_at": "2017-09-21T18:51:23.794Z", - "visualization": { - "title": "Just some noise in the dataset", - "visState": "{}", - "uiStateJSON": "{\"spy\":{\"mode\":{\"name\":null,\"fill\":false}}}", - "description": "", - "version": 1, - "kibanaSavedObjectMeta": { - "searchSourceJSON": "{\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"}}" - } - }, - "references": [] - } - } -} - -{ - "type": "doc", - "value": { - "index": ".kibana", - "id": "visualization:noise-2", - "source": { - "type": "visualization", - "updated_at": "2017-09-21T18:51:23.794Z", - "visualization": { - "title": "Just some noise in the dataset", - "visState": "{}", - "uiStateJSON": "{\"spy\":{\"mode\":{\"name\":null,\"fill\":false}}}", - "description": "", - "version": 1, - "kibanaSavedObjectMeta": { - "searchSourceJSON": "{\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"}}" - } - }, - "references": [] - } - } -} - diff --git a/test/api_integration/fixtures/es_archiver/saved_objects/find_edgecases/mappings.json b/test/api_integration/fixtures/es_archiver/saved_objects/find_edgecases/mappings.json deleted file mode 100644 index 557846fd9fdf4a6..000000000000000 --- a/test/api_integration/fixtures/es_archiver/saved_objects/find_edgecases/mappings.json +++ /dev/null @@ -1,270 +0,0 @@ -{ - "type": "index", - "value": { - "aliases": { - ".kibana": {} - }, - "index": ".kibana_1", - "settings": { - "index": { - "number_of_shards": "1", - "number_of_replicas": "1" - } - }, - "mappings": { - "dynamic": "strict", - "properties": { - "config": { - "dynamic": "true", - "properties": { - "buildNum": { - "type": "keyword" - }, - "defaultIndex": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - }, - "dashboard": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "optionsJSON": { - "type": "text" - }, - "panelsJSON": { - "type": "text" - }, - "refreshInterval": { - "properties": { - "display": { - "type": "keyword" - }, - "pause": { - "type": "boolean" - }, - "section": { - "type": "integer" - }, - "value": { - "type": "integer" - } - } - }, - "timeFrom": { - "type": "keyword" - }, - "timeRestore": { - "type": "boolean" - }, - "timeTo": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "index-pattern": { - "properties": { - "fieldFormatMap": { - "type": "text" - }, - "fields": { - "type": "text" - }, - "intervalName": { - "type": "keyword" - }, - "notExpandable": { - "type": "boolean" - }, - "sourceFilters": { - "type": "text" - }, - "timeFieldName": { - "type": "keyword" - }, - "title": { - "type": "text" - } - } - }, - "search": { - "properties": { - "columns": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "sort": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "server": { - "properties": { - "uuid": { - "type": "keyword" - } - } - }, - "timelion-sheet": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timelion_chart_height": { - "type": "integer" - }, - "timelion_columns": { - "type": "integer" - }, - "timelion_interval": { - "type": "keyword" - }, - "timelion_other_interval": { - "type": "keyword" - }, - "timelion_rows": { - "type": "integer" - }, - "timelion_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "namespace": { - "type": "keyword" - }, - "references": { - "properties": { - "id": { - "type": "keyword" - }, - "name": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - }, - "type": "nested" - }, - "type": { - "type": "keyword" - }, - "updated_at": { - "type": "date" - }, - "url": { - "properties": { - "accessCount": { - "type": "long" - }, - "accessDate": { - "type": "date" - }, - "createDate": { - "type": "date" - }, - "url": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 2048 - } - } - } - } - }, - "visualization": { - "properties": { - "description": { - "type": "text" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "savedSearchId": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - }, - "visState": { - "type": "text" - } - } - } - } - } - } -} diff --git a/test/api_integration/fixtures/es_archiver/saved_objects/references/data.json b/test/api_integration/fixtures/es_archiver/saved_objects/references/data.json deleted file mode 100644 index 8b2095972bd4dfa..000000000000000 --- a/test/api_integration/fixtures/es_archiver/saved_objects/references/data.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "type": "doc", - "value": { - "index": ".kibana", - "id": "visualization:only-ref-1", - "source": { - "type": "visualization", - "updated_at": "2017-09-21T18:51:23.794Z", - "visualization": { - "title": "Vis with ref to ref-1", - "visState": "{}", - "uiStateJSON": "{\"spy\":{\"mode\":{\"name\":null,\"fill\":false}}}", - "description": "", - "version": 1, - "kibanaSavedObjectMeta": { - "searchSourceJSON": "{\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"}}" - } - }, - "references": [ - { - "type": "ref-type", - "id": "ref-1", - "name": "ref-1" - } - ] - } - } -} - -{ - "type": "doc", - "value": { - "index": ".kibana", - "id": "visualization:ref-1-and-ref-2", - "source": { - "type": "visualization", - "updated_at": "2017-09-21T18:51:23.794Z", - "visualization": { - "title": "Vis with ref to ref-1 and ref-2", - "visState": "{}", - "uiStateJSON": "{\"spy\":{\"mode\":{\"name\":null,\"fill\":false}}}", - "description": "", - "version": 1, - "kibanaSavedObjectMeta": { - "searchSourceJSON": "{\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"}}" - } - }, - "references": [ - { - "type": "ref-type", - "id": "ref-1", - "name": "ref-1" - }, - { - "type": "ref-type", - "id": "ref-2", - "name": "ref-2" - } - ] - } - } -} - -{ - "type": "doc", - "value": { - "index": ".kibana", - "id": "visualization:only-ref-2", - "source": { - "type": "visualization", - "updated_at": "2017-09-21T18:51:23.794Z", - "visualization": { - "title": "Vis with ref to ref-2", - "visState": "{}", - "uiStateJSON": "{\"spy\":{\"mode\":{\"name\":null,\"fill\":false}}}", - "description": "", - "version": 1, - "kibanaSavedObjectMeta": { - "searchSourceJSON": "{\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"}}" - } - }, - "references": [ - { - "type": "ref-type", - "id": "ref-2", - "name": "ref-2" - } - ] - } - } -} - -{ - "type": "doc", - "value": { - "index": ".kibana", - "id": "visualization:only-ref-3", - "source": { - "type": "visualization", - "updated_at": "2017-09-21T18:51:23.794Z", - "visualization": { - "title": "Vis with ref to ref-3", - "visState": "{}", - "uiStateJSON": "{\"spy\":{\"mode\":{\"name\":null,\"fill\":false}}}", - "description": "", - "version": 1, - "kibanaSavedObjectMeta": { - "searchSourceJSON": "{\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"}}" - } - }, - "references": [ - { - "type": "ref-type", - "id": "ref-3", - "name": "ref-3" - } - ] - } - } -} diff --git a/test/api_integration/fixtures/es_archiver/saved_objects/references/mappings.json b/test/api_integration/fixtures/es_archiver/saved_objects/references/mappings.json deleted file mode 100644 index 557846fd9fdf4a6..000000000000000 --- a/test/api_integration/fixtures/es_archiver/saved_objects/references/mappings.json +++ /dev/null @@ -1,270 +0,0 @@ -{ - "type": "index", - "value": { - "aliases": { - ".kibana": {} - }, - "index": ".kibana_1", - "settings": { - "index": { - "number_of_shards": "1", - "number_of_replicas": "1" - } - }, - "mappings": { - "dynamic": "strict", - "properties": { - "config": { - "dynamic": "true", - "properties": { - "buildNum": { - "type": "keyword" - }, - "defaultIndex": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - }, - "dashboard": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "optionsJSON": { - "type": "text" - }, - "panelsJSON": { - "type": "text" - }, - "refreshInterval": { - "properties": { - "display": { - "type": "keyword" - }, - "pause": { - "type": "boolean" - }, - "section": { - "type": "integer" - }, - "value": { - "type": "integer" - } - } - }, - "timeFrom": { - "type": "keyword" - }, - "timeRestore": { - "type": "boolean" - }, - "timeTo": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "index-pattern": { - "properties": { - "fieldFormatMap": { - "type": "text" - }, - "fields": { - "type": "text" - }, - "intervalName": { - "type": "keyword" - }, - "notExpandable": { - "type": "boolean" - }, - "sourceFilters": { - "type": "text" - }, - "timeFieldName": { - "type": "keyword" - }, - "title": { - "type": "text" - } - } - }, - "search": { - "properties": { - "columns": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "sort": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "server": { - "properties": { - "uuid": { - "type": "keyword" - } - } - }, - "timelion-sheet": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timelion_chart_height": { - "type": "integer" - }, - "timelion_columns": { - "type": "integer" - }, - "timelion_interval": { - "type": "keyword" - }, - "timelion_other_interval": { - "type": "keyword" - }, - "timelion_rows": { - "type": "integer" - }, - "timelion_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "namespace": { - "type": "keyword" - }, - "references": { - "properties": { - "id": { - "type": "keyword" - }, - "name": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - }, - "type": "nested" - }, - "type": { - "type": "keyword" - }, - "updated_at": { - "type": "date" - }, - "url": { - "properties": { - "accessCount": { - "type": "long" - }, - "accessDate": { - "type": "date" - }, - "createDate": { - "type": "date" - }, - "url": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 2048 - } - } - } - } - }, - "visualization": { - "properties": { - "description": { - "type": "text" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "savedSearchId": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - }, - "visState": { - "type": "text" - } - } - } - } - } - } -} diff --git a/test/api_integration/fixtures/kbn_archiver/index_patterns/basic_kibana.json b/test/api_integration/fixtures/kbn_archiver/index_patterns/basic_kibana.json new file mode 100644 index 000000000000000..2fff00dd22664df --- /dev/null +++ b/test/api_integration/fixtures/kbn_archiver/index_patterns/basic_kibana.json @@ -0,0 +1,15 @@ +{ + "attributes": { + "fields": "[{\"name\":\"bar\",\"type\":\"boolean\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"baz\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"baz.keyword\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"foo\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"nestedField.child\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"nested\":{\"path\":\"nestedField\"}}}]", + "title": "basic_index" + }, + "coreMigrationVersion": "7.14.0", + "id": "91200a00-9efd-11e7-acb3-3dab96693fab", + "migrationVersion": { + "index-pattern": "7.11.0" + }, + "references": [], + "type": "index-pattern", + "updated_at": "2017-09-21T18:49:16.270Z", + "version": "WzEsMl0=" +} \ No newline at end of file diff --git a/test/api_integration/fixtures/kbn_archiver/management/saved_objects/relationships.json b/test/api_integration/fixtures/kbn_archiver/management/saved_objects/relationships.json new file mode 100644 index 000000000000000..da2241952ca373b --- /dev/null +++ b/test/api_integration/fixtures/kbn_archiver/management/saved_objects/relationships.json @@ -0,0 +1,200 @@ +{ + "attributes": { + "description": "", + "hits": 0, + "timelion_chart_height": 275, + "timelion_columns": 2, + "timelion_interval": "auto", + "timelion_rows": 2, + "timelion_sheet": [ + ".es(*)" + ], + "title": "New TimeLion Sheet", + "version": 1 + }, + "coreMigrationVersion": "8.0.0", + "id": "190f3e90-2ec3-11e8-ba48-69fc4e41e1f6", + "references": [], + "type": "timelion-sheet", + "updated_at": "2018-03-23T17:53:30.872Z", + "version": "WzgsMl0=" +} + +{ + "attributes": { + "fields": "[{\"name\":\"_id\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_score\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_source\",\"type\":\"_source\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"id\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true}]", + "title": "saved_objects*" + }, + "coreMigrationVersion": "8.0.0", + "id": "8963ca30-3224-11e8-a572-ffca06da1357", + "migrationVersion": { + "index-pattern": "7.11.0" + }, + "references": [], + "type": "index-pattern", + "updated_at": "2018-03-28T01:08:34.290Z", + "version": "WzksMl0=" +} + +{ + "attributes": { + "columns": [ + "_source" + ], + "description": "", + "hits": 0, + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"highlightAll\":true,\"version\":true,\"query\":{\"query\":\"id:3\",\"language\":\"lucene\"},\"filter\":[],\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\"}" + }, + "sort": [ + [ + "_score", + "desc" + ] + ], + "title": "OneRecord", + "version": 1 + }, + "coreMigrationVersion": "8.0.0", + "id": "960372e0-3224-11e8-a572-ffca06da1357", + "migrationVersion": { + "search": "7.9.3" + }, + "references": [ + { + "id": "8963ca30-3224-11e8-a572-ffca06da1357", + "name": "kibanaSavedObjectMeta.searchSourceJSON.index", + "type": "index-pattern" + } + ], + "type": "search", + "updated_at": "2018-03-28T01:08:55.182Z", + "version": "WzExLDJd" +} + +{ + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"}}" + }, + "savedSearchRefName": "search_0", + "title": "VisualizationFromSavedSearch", + "uiStateJSON": "{\"vis\":{\"params\":{\"sort\":{\"columnIndex\":null,\"direction\":null}}}}", + "version": 1, + "visState": "{\"title\":\"VisualizationFromSavedSearch\",\"type\":\"table\",\"params\":{\"perPage\":10,\"showPartialRows\":false,\"showMeticsAtAllLevels\":false,\"sort\":{\"columnIndex\":null,\"direction\":null},\"showTotal\":false,\"totalFunc\":\"sum\",\"showToolbar\":true},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}}]}" + }, + "coreMigrationVersion": "8.0.0", + "id": "a42c0580-3224-11e8-a572-ffca06da1357", + "migrationVersion": { + "visualization": "7.13.0" + }, + "references": [ + { + "id": "960372e0-3224-11e8-a572-ffca06da1357", + "name": "search_0", + "type": "search" + } + ], + "type": "visualization", + "updated_at": "2018-03-28T01:09:18.936Z", + "version": "WzEyLDJd" +} + +{ + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\"}" + }, + "title": "Visualization", + "uiStateJSON": "{}", + "version": 1, + "visState": "{\"title\":\"Visualization\",\"type\":\"metric\",\"params\":{\"addTooltip\":true,\"addLegend\":false,\"type\":\"metric\",\"metric\":{\"percentageMode\":false,\"useRanges\":false,\"colorSchema\":\"Green to Red\",\"metricColorMode\":\"None\",\"colorsRange\":[{\"from\":0,\"to\":10000}],\"labels\":{\"show\":true},\"invertColors\":false,\"style\":{\"bgFill\":\"#000\",\"bgColor\":false,\"labelColor\":false,\"subText\":\"\",\"fontSize\":60}}},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}}]}" + }, + "coreMigrationVersion": "8.0.0", + "id": "add810b0-3224-11e8-a572-ffca06da1357", + "migrationVersion": { + "visualization": "7.13.0" + }, + "references": [ + { + "id": "8963ca30-3224-11e8-a572-ffca06da1357", + "name": "kibanaSavedObjectMeta.searchSourceJSON.index", + "type": "index-pattern" + } + ], + "type": "visualization", + "updated_at": "2018-03-28T01:09:35.163Z", + "version": "WzEzLDJd" +} + +{ + "attributes": { + "description": "", + "hits": 0, + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[],\"highlightAll\":true,\"version\":true}" + }, + "optionsJSON": "{\"darkTheme\":false,\"useMargins\":true,\"hidePanelTitles\":false}", + "panelsJSON": "[{\"version\":\"7.0.0-alpha1\",\"gridData\":{\"w\":24,\"h\":15,\"x\":0,\"y\":0,\"i\":\"1\"},\"panelIndex\":\"1\",\"embeddableConfig\":{\"enhancements\":{}},\"panelRefName\":\"panel_0\"},{\"version\":\"7.0.0-alpha1\",\"gridData\":{\"w\":24,\"h\":15,\"x\":24,\"y\":0,\"i\":\"2\"},\"panelIndex\":\"2\",\"embeddableConfig\":{\"enhancements\":{}},\"panelRefName\":\"panel_1\"}]", + "timeRestore": false, + "title": "Dashboard", + "version": 1 + }, + "coreMigrationVersion": "8.0.0", + "id": "b70c7ae0-3224-11e8-a572-ffca06da1357", + "migrationVersion": { + "dashboard": "7.11.0" + }, + "references": [ + { + "id": "add810b0-3224-11e8-a572-ffca06da1357", + "name": "panel_0", + "type": "visualization" + }, + { + "id": "a42c0580-3224-11e8-a572-ffca06da1357", + "name": "panel_1", + "type": "visualization" + } + ], + "type": "dashboard", + "updated_at": "2018-03-28T01:09:50.606Z", + "version": "WzE0LDJd" +} + +{ + "attributes": { + "description": "", + "hits": 0, + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"kuery\"}}" + }, + "optionsJSON": "{}", + "panelsJSON": "[]", + "timeRestore": false, + "title": "Dashboard", + "version": 1 + }, + "coreMigrationVersion": "8.0.0", + "id": "invalid-refs", + "migrationVersion": { + "dashboard": "7.11.0" + }, + "references": [ + { + "id": "add810b0-3224-11e8-a572-ffca06da1357", + "name": "valid-ref", + "type": "visualization" + }, + { + "id": "invalid-vis", + "name": "missing-ref", + "type": "visualization" + } + ], + "type": "dashboard", + "updated_at": "2018-03-28T01:09:50.606Z", + "version": "WzE1LDJd" +} \ No newline at end of file diff --git a/test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json b/test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json new file mode 100644 index 000000000000000..4f343b81cd40210 --- /dev/null +++ b/test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json @@ -0,0 +1,97 @@ +{ + "attributes": { + "buildNum": 8467, + "defaultIndex": "91200a00-9efd-11e7-acb3-3dab96693fab" + }, + "coreMigrationVersion": "7.14.0", + "id": "7.0.0-alpha1", + "migrationVersion": { + "config": "7.13.0" + }, + "references": [], + "type": "config", + "updated_at": "2017-09-21T18:49:16.302Z", + "version": "WzksMl0=" +} + +{ + "attributes": { + "fields": "[{\"name\":\"@message\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@message.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@tags\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@tags.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@timestamp\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"_id\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_score\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_source\",\"type\":\"_source\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"agent\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"agent.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"bytes\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"clientip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"extension\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"extension.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.coordinates\",\"type\":\"geo_point\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.dest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.src\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.srcdest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"headings\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"headings.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"host.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"id\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"index.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"ip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"links\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"links.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.os\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"machine.os.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.ram\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"memory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.char\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.related\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.firstname\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.lastname\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"phpmemory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"referer\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:modified_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:published_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:section\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:section.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:tag\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:tag.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:height\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:height.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:width\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:width.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:site_name\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:site_name.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:type.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:card\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:card.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:site\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:site.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"request\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"request.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"response\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"response.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"spaces\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"spaces.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"utc_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"xss\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"xss.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true}]", + "timeFieldName": "@timestamp", + "title": "logstash-*" + }, + "coreMigrationVersion": "7.14.0", + "id": "91200a00-9efd-11e7-acb3-3dab96693fab", + "migrationVersion": { + "index-pattern": "7.11.0" + }, + "references": [], + "type": "index-pattern", + "updated_at": "2017-09-21T18:49:16.270Z", + "version": "WzgsMl0=" +} + +{ + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\"}" + }, + "title": "Count of requests", + "uiStateJSON": "{\"spy\":{\"mode\":{\"name\":null,\"fill\":false}}}", + "version": 1, + "visState": "{\"title\":\"Count of requests\",\"type\":\"area\",\"params\":{\"type\":\"area\",\"grid\":{\"categoryLines\":false,\"style\":{\"color\":\"#eee\"}},\"categoryAxes\":[{\"id\":\"CategoryAxis-1\",\"type\":\"category\",\"position\":\"bottom\",\"show\":true,\"style\":{},\"scale\":{\"type\":\"linear\"},\"labels\":{\"show\":true,\"truncate\":100,\"filter\":true},\"title\":{}}],\"valueAxes\":[{\"id\":\"ValueAxis-1\",\"name\":\"LeftAxis-1\",\"type\":\"value\",\"position\":\"left\",\"show\":true,\"style\":{},\"scale\":{\"type\":\"linear\",\"mode\":\"normal\"},\"labels\":{\"show\":true,\"rotate\":0,\"filter\":false,\"truncate\":100},\"title\":{\"text\":\"Count\"}}],\"seriesParams\":[{\"show\":\"true\",\"type\":\"area\",\"mode\":\"stacked\",\"data\":{\"label\":\"Count\",\"id\":\"1\"},\"drawLinesBetweenPoints\":true,\"showCircles\":true,\"interpolate\":\"linear\",\"valueAxis\":\"ValueAxis-1\"}],\"addTooltip\":true,\"addLegend\":true,\"legendPosition\":\"right\",\"times\":[],\"addTimeMarker\":false,\"palette\":{\"type\":\"palette\",\"name\":\"kibana_palette\"},\"isVislibVis\":true,\"detailedTooltip\":true,\"fittingFunction\":\"zero\"},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"enabled\":true,\"type\":\"date_histogram\",\"schema\":\"segment\",\"params\":{\"field\":\"@timestamp\",\"interval\":\"auto\",\"min_doc_count\":1,\"extended_bounds\":{}}}]}" + }, + "coreMigrationVersion": "7.14.0", + "id": "dd7caf20-9efd-11e7-acb3-3dab96693fab", + "migrationVersion": { + "visualization": "7.13.0" + }, + "references": [ + { + "id": "91200a00-9efd-11e7-acb3-3dab96693fab", + "name": "kibanaSavedObjectMeta.searchSourceJSON.index", + "type": "index-pattern" + } + ], + "type": "visualization", + "updated_at": "2017-09-21T18:51:23.794Z", + "version": "WzEwLDJd" +} + +{ + "attributes": { + "description": "", + "hits": 0, + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[],\"highlightAll\":true,\"version\":true}" + }, + "optionsJSON": "{\"darkTheme\":false}", + "panelsJSON": "[{\"version\":\"7.3.0\",\"type\":\"visualization\",\"gridData\":{\"x\":0,\"y\":0,\"w\":24,\"h\":12,\"i\":\"1\"},\"panelIndex\":\"1\",\"embeddableConfig\":{\"enhancements\":{}},\"panelRefName\":\"panel_1\"}]", + "refreshInterval": { + "display": "Off", + "pause": false, + "value": 0 + }, + "timeFrom": "Wed Sep 16 2015 22:52:17 GMT-0700", + "timeRestore": true, + "timeTo": "Fri Sep 18 2015 12:24:38 GMT-0700", + "title": "Requests", + "version": 1 + }, + "coreMigrationVersion": "7.14.0", + "id": "be3733a0-9efe-11e7-acb3-3dab96693fab", + "migrationVersion": { + "dashboard": "7.11.0" + }, + "references": [ + { + "id": "dd7caf20-9efd-11e7-acb3-3dab96693fab", + "name": "1:panel_1", + "type": "visualization" + } + ], + "type": "dashboard", + "updated_at": "2017-09-21T18:57:40.826Z", + "version": "WzExLDJd" +} \ No newline at end of file diff --git a/test/api_integration/fixtures/kbn_archiver/saved_objects/basic/foo-ns.json b/test/api_integration/fixtures/kbn_archiver/saved_objects/basic/foo-ns.json new file mode 100644 index 000000000000000..736abf331d3146e --- /dev/null +++ b/test/api_integration/fixtures/kbn_archiver/saved_objects/basic/foo-ns.json @@ -0,0 +1,97 @@ +{ + "attributes": { + "buildNum": 8467, + "defaultIndex": "91200a00-9efd-11e7-acb3-3dab96693fab" + }, + "coreMigrationVersion": "7.14.0", + "id": "7.0.0-alpha1", + "migrationVersion": { + "config": "7.13.0" + }, + "references": [], + "type": "config", + "updated_at": "2017-09-21T18:49:16.302Z", + "version": "WzEzLDJd" +} + +{ + "attributes": { + "fields": "[{\"name\":\"@message\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@message.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@tags\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@tags.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@timestamp\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"_id\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_score\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_source\",\"type\":\"_source\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"agent\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"agent.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"bytes\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"clientip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"extension\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"extension.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.coordinates\",\"type\":\"geo_point\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.dest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.src\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.srcdest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"headings\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"headings.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"host.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"id\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"index.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"ip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"links\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"links.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.os\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"machine.os.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.ram\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"memory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.char\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.related\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.firstname\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.lastname\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"phpmemory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"referer\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:modified_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:published_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:section\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:section.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:tag\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:tag.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:height\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:height.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:width\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:width.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:site_name\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:site_name.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:type.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:card\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:card.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:site\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:site.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"request\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"request.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"response\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"response.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"spaces\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"spaces.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"utc_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"xss\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"xss.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true}]", + "timeFieldName": "@timestamp", + "title": "logstash-*" + }, + "coreMigrationVersion": "7.14.0", + "id": "91200a00-9efd-11e7-acb3-3dab96693fab", + "migrationVersion": { + "index-pattern": "7.11.0" + }, + "references": [], + "type": "index-pattern", + "updated_at": "2017-09-21T18:49:16.270Z", + "version": "WzEyLDJd" +} + +{ + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\"}" + }, + "title": "Count of requests", + "uiStateJSON": "{\"spy\":{\"mode\":{\"name\":null,\"fill\":false}}}", + "version": 1, + "visState": "{\"title\":\"Count of requests\",\"type\":\"area\",\"params\":{\"type\":\"area\",\"grid\":{\"categoryLines\":false,\"style\":{\"color\":\"#eee\"}},\"categoryAxes\":[{\"id\":\"CategoryAxis-1\",\"type\":\"category\",\"position\":\"bottom\",\"show\":true,\"style\":{},\"scale\":{\"type\":\"linear\"},\"labels\":{\"show\":true,\"truncate\":100,\"filter\":true},\"title\":{}}],\"valueAxes\":[{\"id\":\"ValueAxis-1\",\"name\":\"LeftAxis-1\",\"type\":\"value\",\"position\":\"left\",\"show\":true,\"style\":{},\"scale\":{\"type\":\"linear\",\"mode\":\"normal\"},\"labels\":{\"show\":true,\"rotate\":0,\"filter\":false,\"truncate\":100},\"title\":{\"text\":\"Count\"}}],\"seriesParams\":[{\"show\":\"true\",\"type\":\"area\",\"mode\":\"stacked\",\"data\":{\"label\":\"Count\",\"id\":\"1\"},\"drawLinesBetweenPoints\":true,\"showCircles\":true,\"interpolate\":\"linear\",\"valueAxis\":\"ValueAxis-1\"}],\"addTooltip\":true,\"addLegend\":true,\"legendPosition\":\"right\",\"times\":[],\"addTimeMarker\":false,\"palette\":{\"type\":\"palette\",\"name\":\"kibana_palette\"},\"isVislibVis\":true,\"detailedTooltip\":true,\"fittingFunction\":\"zero\"},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"enabled\":true,\"type\":\"date_histogram\",\"schema\":\"segment\",\"params\":{\"field\":\"@timestamp\",\"interval\":\"auto\",\"min_doc_count\":1,\"extended_bounds\":{}}}]}" + }, + "coreMigrationVersion": "7.14.0", + "id": "dd7caf20-9efd-11e7-acb3-3dab96693fab", + "migrationVersion": { + "visualization": "7.13.0" + }, + "references": [ + { + "id": "91200a00-9efd-11e7-acb3-3dab96693fab", + "name": "kibanaSavedObjectMeta.searchSourceJSON.index", + "type": "index-pattern" + } + ], + "type": "visualization", + "updated_at": "2017-09-21T18:51:23.794Z", + "version": "WzE0LDJd" +} + +{ + "attributes": { + "description": "", + "hits": 0, + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[],\"highlightAll\":true,\"version\":true}" + }, + "optionsJSON": "{\"darkTheme\":false}", + "panelsJSON": "[{\"version\":\"7.3.0\",\"type\":\"visualization\",\"gridData\":{\"x\":0,\"y\":0,\"w\":24,\"h\":12,\"i\":\"1\"},\"panelIndex\":\"1\",\"embeddableConfig\":{\"enhancements\":{}},\"panelRefName\":\"panel_1\"}]", + "refreshInterval": { + "display": "Off", + "pause": false, + "value": 0 + }, + "timeFrom": "Wed Sep 16 2015 22:52:17 GMT-0700", + "timeRestore": true, + "timeTo": "Fri Sep 18 2015 12:24:38 GMT-0700", + "title": "Requests", + "version": 1 + }, + "coreMigrationVersion": "7.14.0", + "id": "be3733a0-9efe-11e7-acb3-3dab96693fab", + "migrationVersion": { + "dashboard": "7.11.0" + }, + "references": [ + { + "id": "dd7caf20-9efd-11e7-acb3-3dab96693fab", + "name": "1:panel_1", + "type": "visualization" + } + ], + "type": "dashboard", + "updated_at": "2017-09-21T18:57:40.826Z", + "version": "WzE1LDJd" +} \ No newline at end of file diff --git a/test/api_integration/fixtures/kbn_archiver/saved_objects/find_edgecases.json b/test/api_integration/fixtures/kbn_archiver/saved_objects/find_edgecases.json new file mode 100644 index 000000000000000..7b181e10b958fa8 --- /dev/null +++ b/test/api_integration/fixtures/kbn_archiver/saved_objects/find_edgecases.json @@ -0,0 +1,87 @@ +{ + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"}}" + }, + "title": "Just some noise in the dataset", + "uiStateJSON": "{\"spy\":{\"mode\":{\"name\":null,\"fill\":false}}}", + "version": 1, + "visState": "{}" + }, + "coreMigrationVersion": "8.0.0", + "id": "noise-1", + "migrationVersion": { + "visualization": "7.13.0" + }, + "references": [], + "type": "visualization", + "updated_at": "2017-09-21T18:51:23.794Z", + "version": "WzYsMl0=" +} + +{ + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"}}" + }, + "title": "Just some noise in the dataset", + "uiStateJSON": "{\"spy\":{\"mode\":{\"name\":null,\"fill\":false}}}", + "version": 1, + "visState": "{}" + }, + "coreMigrationVersion": "8.0.0", + "id": "noise-2", + "migrationVersion": { + "visualization": "7.13.0" + }, + "references": [], + "type": "visualization", + "updated_at": "2017-09-21T18:51:23.794Z", + "version": "WzcsMl0=" +} + +{ + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"}}" + }, + "title": "some*visualization", + "uiStateJSON": "{\"spy\":{\"mode\":{\"name\":null,\"fill\":false}}}", + "version": 1, + "visState": "{}" + }, + "coreMigrationVersion": "8.0.0", + "id": "title-with-asterisk", + "migrationVersion": { + "visualization": "7.13.0" + }, + "references": [], + "type": "visualization", + "updated_at": "2017-09-21T18:51:23.794Z", + "version": "WzUsMl0=" +} + +{ + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"}}" + }, + "title": "my-visualization", + "uiStateJSON": "{\"spy\":{\"mode\":{\"name\":null,\"fill\":false}}}", + "version": 1, + "visState": "{}" + }, + "coreMigrationVersion": "8.0.0", + "id": "title-with-dash", + "migrationVersion": { + "visualization": "7.13.0" + }, + "references": [], + "type": "visualization", + "updated_at": "2017-09-21T18:51:23.794Z", + "version": "WzQsMl0=" +} \ No newline at end of file diff --git a/test/api_integration/fixtures/kbn_archiver/saved_objects/references.json b/test/api_integration/fixtures/kbn_archiver/saved_objects/references.json new file mode 100644 index 000000000000000..1da6ed3731e3208 --- /dev/null +++ b/test/api_integration/fixtures/kbn_archiver/saved_objects/references.json @@ -0,0 +1,116 @@ +{ + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"}}" + }, + "title": "Vis with ref to ref-1", + "uiStateJSON": "{\"spy\":{\"mode\":{\"name\":null,\"fill\":false}}}", + "version": 1, + "visState": "{}" + }, + "coreMigrationVersion": "8.0.0", + "id": "only-ref-1", + "migrationVersion": { + "visualization": "7.13.0" + }, + "references": [ + { + "id": "ref-1", + "name": "ref-1", + "type": "ref-type" + } + ], + "type": "visualization", + "updated_at": "2017-09-21T18:51:23.794Z", + "version": "WzQsMl0=" +} + +{ + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"}}" + }, + "title": "Vis with ref to ref-2", + "uiStateJSON": "{\"spy\":{\"mode\":{\"name\":null,\"fill\":false}}}", + "version": 1, + "visState": "{}" + }, + "coreMigrationVersion": "8.0.0", + "id": "only-ref-2", + "migrationVersion": { + "visualization": "7.13.0" + }, + "references": [ + { + "id": "ref-2", + "name": "ref-2", + "type": "ref-type" + } + ], + "type": "visualization", + "updated_at": "2017-09-21T18:51:23.794Z", + "version": "WzYsMl0=" +} + +{ + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"}}" + }, + "title": "Vis with ref to ref-3", + "uiStateJSON": "{\"spy\":{\"mode\":{\"name\":null,\"fill\":false}}}", + "version": 1, + "visState": "{}" + }, + "coreMigrationVersion": "8.0.0", + "id": "only-ref-3", + "migrationVersion": { + "visualization": "7.13.0" + }, + "references": [ + { + "id": "ref-3", + "name": "ref-3", + "type": "ref-type" + } + ], + "type": "visualization", + "updated_at": "2017-09-21T18:51:23.794Z", + "version": "WzcsMl0=" +} + +{ + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"}}" + }, + "title": "Vis with ref to ref-1 and ref-2", + "uiStateJSON": "{\"spy\":{\"mode\":{\"name\":null,\"fill\":false}}}", + "version": 1, + "visState": "{}" + }, + "coreMigrationVersion": "8.0.0", + "id": "ref-1-and-ref-2", + "migrationVersion": { + "visualization": "7.13.0" + }, + "references": [ + { + "id": "ref-1", + "name": "ref-1", + "type": "ref-type" + }, + { + "id": "ref-2", + "name": "ref-2", + "type": "ref-type" + } + ], + "type": "visualization", + "updated_at": "2017-09-21T18:51:23.794Z", + "version": "WzUsMl0=" +} \ No newline at end of file diff --git a/x-pack/test/api_integration/apis/kibana/kql_telemetry/kql_telemetry.js b/x-pack/test/api_integration/apis/kibana/kql_telemetry/kql_telemetry.js index d22018615c404be..95a65de81e85b60 100644 --- a/x-pack/test/api_integration/apis/kibana/kql_telemetry/kql_telemetry.js +++ b/x-pack/test/api_integration/apis/kibana/kql_telemetry/kql_telemetry.js @@ -10,12 +10,8 @@ import expect from '@kbn/expect'; export default function ({ getService }) { const supertestNoAuth = getService('supertestWithoutAuth'); const supertest = getService('supertest'); - const esArchiver = getService('esArchiver'); describe('telemetry API', () => { - before(() => esArchiver.load('x-pack/test/functional/es_archives/empty_kibana')); - after(() => esArchiver.unload('x-pack/test/functional/es_archives/empty_kibana')); - describe('no auth', () => { it('should return 401', async () => { return supertestNoAuth