[FTR] Use importExport for saved_object/basic archive (#100244)

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
This commit is contained in:
Tyler Smalley 2021-06-01 11:50:49 -07:00 committed by GitHub
parent eff776560e
commit 0f9debeba7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 2330 additions and 6961 deletions

View file

@ -8,13 +8,14 @@
import { ToolingLog } from '@kbn/dev-utils';
import { KbnClientRequester, ReqOptions } from './kbn_client_requester';
import { KbnClientStatus } from './kbn_client_status';
import { KbnClientPlugins } from './kbn_client_plugins';
import { KbnClientVersion } from './kbn_client_version';
import { KbnClientSavedObjects } from './kbn_client_saved_objects';
import { KbnClientUiSettings, UiSettingValues } from './kbn_client_ui_settings';
import { KbnClientImportExport } from './kbn_client_import_export';
import { KbnClientPlugins } from './kbn_client_plugins';
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 { 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,

View file

@ -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),
});

View file

@ -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}`,
});
}
}

View file

@ -41,6 +41,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',
@ -61,8 +62,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',
@ -98,7 +97,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',

View file

@ -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('saved_objects/basic'));
after(() => esArchiver.unload('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

View file

@ -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,15 +38,15 @@ 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('saved_objects/basic'));
after(() => esArchiver.unload('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`)
.post(`/s/${SPACE_ID}/api/saved_objects/_bulk_create`)
.send(BULK_REQUESTS)
.expect(200)
.then((resp) => {
@ -75,7 +75,7 @@ export default function ({ getService }: FtrProviderContext) {
},
coreMigrationVersion: KIBANA_VERSION,
references: [],
namespaces: ['default'],
namespaces: [SPACE_ID],
},
],
});
@ -83,7 +83,7 @@ export default function ({ getService }: FtrProviderContext) {
it('should not return raw id when object id is unspecified', async () =>
await supertest
.post(`/api/saved_objects/_bulk_create`)
.post(`/s/${SPACE_ID}/api/saved_objects/_bulk_create`)
.send(BULK_REQUESTS.map(({ id, ...rest }) => rest))
.expect(200)
.then((resp) => {
@ -92,45 +92,4 @@ 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 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,
},
},
{
id: BULK_REQUESTS[1].id,
type: BULK_REQUESTS[1].type,
error: {
error: 'Internal Server Error',
message: 'An internal server error occurred',
statusCode: 500,
},
},
],
});
});
});
});
});
}

View file

@ -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,11 +34,10 @@ 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('saved_objects/basic'));
after(() => esArchiver.unload('saved_objects/basic'));
after(() => kibanaServer.importExport.unload('saved_objects/basic'));
it('should return 200 with individual responses', async () =>
await supertest
@ -47,12 +45,16 @@ export default function ({ getService }: FtrProviderContext) {
.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;
expect(resp.body).to.eql({
saved_objects: [
{
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_objects[0].version,
attributes: {
title: 'Count of requests',
@ -87,7 +89,7 @@ export default function ({ getService }: FtrProviderContext) {
{
id: '7.0.0-alpha1',
type: 'config',
updated_at: '2017-09-21T18:49:16.302Z',
updated_at: '2015-01-01T00:00:00.000Z',
version: resp.body.saved_objects[2].version,
attributes: {
buildNum: 8467,
@ -103,53 +105,4 @@ export default function ({ getService }: FtrProviderContext) {
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) => {
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,
},
},
{
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,
},
},
],
});
}));
});
});
}

View file

@ -12,13 +12,12 @@ 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('saved_objects/basic'));
after(() => esArchiver.unload('saved_objects/basic'));
before(() => kibanaServer.importExport.load('saved_objects/basic'));
after(() => kibanaServer.importExport.unload('saved_objects/basic'));
it('should return 200', async () => {
const response = await supertest
.put(`/api/saved_objects/_bulk_update`)
@ -230,59 +229,4 @@ 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 errors', 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;
expect(firstObject).to.eql({
id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab',
type: 'visualization',
error: {
statusCode: 500,
error: 'Internal Server Error',
message: 'An internal server error occurred',
},
});
expect(secondObject).to.eql({
id: 'be3733a0-9efe-11e7-acb3-3dab96693fab',
type: 'dashboard',
error: {
statusCode: 500,
error: 'Internal Server Error',
message: 'An internal server error occurred',
},
});
});
});
});
}

View file

@ -12,20 +12,18 @@ 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('saved_objects/basic'));
after(() => esArchiver.unload('saved_objects/basic'));
after(() => kibanaServer.importExport.unload('saved_objects/basic'));
it('should return 200', async () => {
await supertest
.post(`/api/saved_objects/visualization`)
@ -78,33 +76,4 @@ 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 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);
});
});
});
}

View file

@ -11,13 +11,11 @@ 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('saved_objects/basic'));
after(() => esArchiver.unload('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
@ -39,25 +37,4 @@ export default function ({ getService }: FtrProviderContext) {
});
}));
});
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',
});
}));
});
});
}

View file

@ -15,24 +15,24 @@ 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('saved_objects/basic'));
after(() => esArchiver.unload('saved_objects/basic'));
after(() => kibanaServer.spaces.delete(SPACE_ID));
describe('basic amount of saved objects', () => {
it('should return objects in dependency order', async () => {
await supertest
.post('/api/saved_objects/_export')
.post(`/s/${SPACE_ID}/api/saved_objects/_export`)
.send({
type: ['index-pattern', 'search', 'visualization', 'dashboard'],
})
@ -54,7 +54,7 @@ export default function ({ getService }: FtrProviderContext) {
it('should exclude the export details if asked', async () => {
await supertest
.post('/api/saved_objects/_export')
.post(`/s/${SPACE_ID}/api/saved_objects/_export`)
.send({
type: ['index-pattern', 'search', 'visualization', 'dashboard'],
excludeExportDetails: true,
@ -74,7 +74,7 @@ export default function ({ getService }: FtrProviderContext) {
it('should support including dependencies when exporting selected objects', async () => {
await supertest
.post('/api/saved_objects/_export')
.post(`/s/${SPACE_ID}/api/saved_objects/_export`)
.send({
includeReferencesDeep: true,
objects: [
@ -102,7 +102,7 @@ export default function ({ getService }: FtrProviderContext) {
it('should support including dependencies when exporting by type', async () => {
await supertest
.post('/api/saved_objects/_export')
.post(`/s/${SPACE_ID}/api/saved_objects/_export`)
.send({
includeReferencesDeep: true,
type: ['dashboard'],
@ -125,7 +125,7 @@ export default function ({ getService }: FtrProviderContext) {
it('should support including dependencies when exporting by type and search', async () => {
await supertest
.post('/api/saved_objects/_export')
.post(`/s/${SPACE_ID}/api/saved_objects/_export`)
.send({
includeReferencesDeep: true,
type: ['dashboard'],
@ -149,7 +149,7 @@ export default function ({ getService }: FtrProviderContext) {
it(`should throw error when object doesn't exist`, async () => {
await supertest
.post('/api/saved_objects/_export')
.post(`/s/${SPACE_ID}/api/saved_objects/_export`)
.send({
objects: [
{
@ -183,7 +183,7 @@ export default function ({ getService }: FtrProviderContext) {
it(`should return 400 when exporting unsupported type`, async () => {
await supertest
.post('/api/saved_objects/_export')
.post(`/s/${SPACE_ID}/api/saved_objects/_export`)
.send({
type: ['wigwags'],
})
@ -199,7 +199,7 @@ export default function ({ getService }: FtrProviderContext) {
it(`should return 400 when exporting objects with unsupported type`, async () => {
await supertest
.post('/api/saved_objects/_export')
.post(`/s/${SPACE_ID}/api/saved_objects/_export`)
.send({
objects: [
{
@ -249,9 +249,12 @@ export default function ({ getService }: FtrProviderContext) {
],
},
];
await supertest.post('/api/saved_objects/_bulk_create').send(soWithCycliRefs).expect(200);
await supertest
.post(`/s/${SPACE_ID}/api/saved_objects/_bulk_create`)
.send(soWithCycliRefs)
.expect(200);
const resp = await supertest
.post('/api/saved_objects/_export')
.post(`/s/${SPACE_ID}/api/saved_objects/_export`)
.send({
includeReferencesDeep: true,
type: ['dashboard'],
@ -265,12 +268,38 @@ export default function ({ getService }: FtrProviderContext) {
});
describe('10,000 objects', () => {
before(() => esArchiver.load('saved_objects/10k'));
after(() => esArchiver.unload('saved_objects/10k'));
before(async () => {
const fileChunks = [];
for (let i = 0; i <= 9995; i++) {
fileChunks.push(
JSON.stringify({
type: 'visualization',
id: `${SPACE_ID}-${i}`,
attributes: {
title: `My visualization (${i})`,
uiStateJSON: '{}',
visState: '{}',
},
references: [
{
name: 'kibanaSavedObjectMeta.searchSourceJSON.index',
type: 'index-pattern',
id: '91200a00-9efd-11e7-acb3-3dab96693fab',
},
],
})
);
}
await supertest
.post(`/s/${SPACE_ID}/api/saved_objects/_import`)
.attach('file', Buffer.from(fileChunks.join('\n'), 'utf8'), 'export.ndjson')
.expect(200);
});
it('should return 400 when exporting without type or objects passed in', async () => {
await supertest
.post('/api/saved_objects/_export')
.post(`/s/${SPACE_ID}/api/saved_objects/_export`)
.expect(400)
.then((resp) => {
expect(resp.body).to.eql({
@ -283,7 +312,7 @@ export default function ({ getService }: FtrProviderContext) {
it('should return 200 when exporting by single type', async () => {
await supertest
.post('/api/saved_objects/_export')
.post(`/s/${SPACE_ID}/api/saved_objects/_export`)
.send({
type: 'dashboard',
excludeExportDetails: true,
@ -298,6 +327,7 @@ export default function ({ getService }: FtrProviderContext) {
// Sort values aren't deterministic so we need to exclude them
const { sort, ...obj } = objects[0];
expect(obj).to.eql({
attributes: {
description: '',
@ -329,7 +359,7 @@ export default function ({ getService }: FtrProviderContext) {
},
],
type: 'dashboard',
updated_at: '2017-09-21T18:57:40.826Z',
updated_at: objects[0].updated_at,
version: objects[0].version,
});
expect(objects[0].migrationVersion).to.be.ok();
@ -343,7 +373,7 @@ export default function ({ getService }: FtrProviderContext) {
it('should return 200 when exporting by array type', async () => {
await supertest
.post('/api/saved_objects/_export')
.post(`/s/${SPACE_ID}/api/saved_objects/_export`)
.send({
type: ['dashboard'],
excludeExportDetails: true,
@ -389,7 +419,7 @@ export default function ({ getService }: FtrProviderContext) {
},
],
type: 'dashboard',
updated_at: '2017-09-21T18:57:40.826Z',
updated_at: objects[0].updated_at,
version: objects[0].version,
});
expect(objects[0].migrationVersion).to.be.ok();
@ -403,7 +433,7 @@ export default function ({ getService }: FtrProviderContext) {
it('should return 200 when exporting by objects', async () => {
await supertest
.post('/api/saved_objects/_export')
.post(`/s/${SPACE_ID}/api/saved_objects/_export`)
.send({
objects: [
{
@ -454,7 +484,7 @@ export default function ({ getService }: FtrProviderContext) {
},
],
type: 'dashboard',
updated_at: '2017-09-21T18:57:40.826Z',
updated_at: objects[0].updated_at,
version: objects[0].version,
});
expect(objects[0].migrationVersion).to.be.ok();
@ -468,7 +498,7 @@ export default function ({ getService }: FtrProviderContext) {
it('should return 400 when exporting by type and objects', async () => {
await supertest
.post('/api/saved_objects/_export')
.post(`/s/${SPACE_ID}/api/saved_objects/_export`)
.send({
type: 'dashboard',
objects: [
@ -488,32 +518,10 @@ export default function ({ getService }: FtrProviderContext) {
});
});
});
});
describe('10,001 objects', () => {
let customVisId: string;
before(async () => {
await esArchiver.load('saved_objects/10k');
await supertest
.post('/api/saved_objects/visualization')
.send({
attributes: {
title: 'My favorite vis',
},
})
.expect(200)
.then((resp) => {
customVisId = resp.body.id;
});
});
after(async () => {
await supertest.delete(`/api/saved_objects/visualization/${customVisId}`).expect(200);
await esArchiver.unload('saved_objects/10k');
});
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: ['dashboard', 'visualization', 'search', 'index-pattern'],
excludeExportDetails: true,
@ -532,7 +540,7 @@ export default function ({ getService }: FtrProviderContext) {
it('should return 400 when exporting more than allowed by maxImportExportSize', async () => {
let anotherCustomVisId: string;
await supertest
.post('/api/saved_objects/visualization')
.post(`/s/${SPACE_ID}/api/saved_objects/visualization`)
.send({
attributes: {
title: 'My other favorite vis',
@ -543,7 +551,7 @@ export default function ({ getService }: FtrProviderContext) {
anotherCustomVisId = resp.body.id;
});
await supertest
.post('/api/saved_objects/_export')
.post(`/s/${SPACE_ID}/api/saved_objects/_export`)
.send({
type: ['dashboard', 'visualization', 'search', 'index-pattern'],
excludeExportDetails: true,
@ -558,31 +566,9 @@ export default function ({ getService }: FtrProviderContext) {
});
await supertest
// @ts-expect-error TS complains about using `anotherCustomVisId` before it is assigned
.delete(`/api/saved_objects/visualization/${anotherCustomVisId}`)
.delete(`/s/${SPACE_ID}/api/saved_objects/visualization/${anotherCustomVisId}`)
.expect(200);
});
});
});
describe('without kibana index', () => {
before(
async () =>
// just in case the kibana server has recreated it
await esDeleteAllIndices('.kibana*')
);
it('should return empty response', async () => {
await supertest
.post('/api/saved_objects/_export')
.send({
type: ['index-pattern', 'search', 'visualization', 'dashboard'],
excludeExportDetails: true,
})
.expect(200)
.then((resp) => {
expect(resp.text).to.eql('');
});
});
});
});
}

View file

@ -12,17 +12,28 @@ 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('saved_objects/basic'));
after(() => esArchiver.unload('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 });
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('/api/saved_objects/_find?type=visualization&fields=title')
.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([
@ -34,7 +45,7 @@ export default function ({ getService }: FtrProviderContext) {
describe('unknown type', () => {
it('should return 200 with empty response', async () =>
await supertest
.get('/api/saved_objects/_find?type=wigwags')
.get(`/s/${SPACE_ID}/api/saved_objects/_find?type=wigwags`)
.expect(200)
.then((resp) => {
expect(resp.body).to.eql({
@ -50,7 +61,7 @@ export default function ({ getService }: FtrProviderContext) {
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')
.get(`/s/${SPACE_ID}/api/saved_objects/_find?type=visualization&page=100&per_page=100`)
.expect(200)
.then((resp) => {
expect(resp.body).to.eql({
@ -65,7 +76,7 @@ export default function ({ getService }: FtrProviderContext) {
describe('unknown search field', () => {
it('should return 200 with empty response', async () =>
await supertest
.get('/api/saved_objects/_find?type=url&search_fields=a')
.get(`/s/${SPACE_ID}/api/saved_objects/_find?type=url&search_fields=a`)
.expect(200)
.then((resp) => {
expect(resp.body).to.eql({
@ -80,7 +91,7 @@ export default function ({ getService }: FtrProviderContext) {
describe('unknown namespace', () => {
it('should return 200 with empty response', async () =>
await supertest
.get('/api/saved_objects/_find?type=visualization&namespaces=foo')
.get(`/s/${SPACE_ID}/api/saved_objects/_find?type=visualization&namespaces=foo`)
.expect(200)
.then((resp) => {
expect(resp.body).to.eql({
@ -95,7 +106,7 @@ export default function ({ getService }: FtrProviderContext) {
describe('known namespace', () => {
it('should return 200 with individual responses', async () =>
await supertest
.get('/api/saved_objects/_find?type=visualization&fields=title&namespaces=default')
.get(`/api/saved_objects/_find?type=visualization&fields=title&namespaces=${SPACE_ID}`)
.expect(200)
.then((resp) => {
expect(
@ -103,7 +114,7 @@ export default function ({ getService }: FtrProviderContext) {
id: so.id,
namespaces: so.namespaces,
}))
).to.eql([{ id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', namespaces: ['default'] }]);
).to.eql([{ id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', namespaces: [SPACE_ID] }]);
expect(resp.body.saved_objects[0].migrationVersion).to.be.ok();
}));
});
@ -111,17 +122,21 @@ export default function ({ getService }: FtrProviderContext) {
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=*')
.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))
);
expect(
resp.body.saved_objects.map((so: { id: string; namespaces: string[] }) => ({
knownDocuments.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'] },
{ id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', namespaces: [SPACE_ID] },
{ id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', namespaces: [`${SPACE_ID}-foo`] },
]);
}));
});
@ -130,7 +145,7 @@ export default function ({ getService }: FtrProviderContext) {
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"'
`/s/${SPACE_ID}/api/saved_objects/_find?type=visualization&filter=visualization.attributes.title:"Count of requests"`
)
.expect(200)
.then((resp) => {
@ -142,7 +157,7 @@ export default function ({ getService }: FtrProviderContext) {
it('wrong type should return 400 with Bad Request', async () =>
await supertest
.get(
'/api/saved_objects/_find?type=visualization&filter=dashboard.attributes.title:foo'
`/s/${SPACE_ID}/api/saved_objects/_find?type=visualization&filter=dashboard.attributes.title:foo`
)
.expect(400)
.then((resp) => {
@ -156,7 +171,7 @@ export default function ({ getService }: FtrProviderContext) {
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<invalid'
`/s/${SPACE_ID}/api/saved_objects/_find?type=dashboard&filter=dashboard.attributes.title:foo<invalid`
)
.expect(400)
.then((resp) => {
@ -174,7 +189,7 @@ export default function ({ getService }: FtrProviderContext) {
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(
`/s/${SPACE_ID}/api/saved_objects/_find?type=visualization&per_page=0&aggs=${encodeURIComponent(
JSON.stringify({
type_count: { max: { field: 'visualization.attributes.version' } },
})
@ -198,7 +213,7 @@ export default function ({ getService }: FtrProviderContext) {
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(
`/s/${SPACE_ID}/api/saved_objects/_find?type=visualization&per_page=0&aggs=${encodeURIComponent(
JSON.stringify({
type_count: { max: { field: 'dashboard.attributes.version' } },
})
@ -217,7 +232,7 @@ export default function ({ getService }: FtrProviderContext) {
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(
`/s/${SPACE_ID}/api/saved_objects/_find?type=visualization&per_page=0&aggs=${encodeURIComponent(
JSON.stringify({
type_count: {
max: {
@ -240,12 +255,14 @@ export default function ({ getService }: FtrProviderContext) {
});
describe('`has_reference` and `has_reference_operator` parameters', () => {
before(() => esArchiver.load('saved_objects/references'));
after(() => esArchiver.unload('saved_objects/references'));
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')
.get(`/s/${SPACE_ID}/api/saved_objects/_find`)
.query({
type: 'visualization',
has_reference: JSON.stringify({ type: 'ref-type', id: 'ref-1' }),
@ -262,7 +279,7 @@ export default function ({ getService }: FtrProviderContext) {
it('search for multiple references with OR operator', async () => {
await supertest
.get('/api/saved_objects/_find')
.get(`/s/${SPACE_ID}/api/saved_objects/_find`)
.query({
type: 'visualization',
has_reference: JSON.stringify([
@ -276,15 +293,15 @@ export default function ({ getService }: FtrProviderContext) {
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',
'ref-1-and-ref-2',
]);
});
});
it('search for multiple references with AND operator', async () => {
await supertest
.get('/api/saved_objects/_find')
.get(`/s/${SPACE_ID}/api/saved_objects/_find`)
.query({
type: 'visualization',
has_reference: JSON.stringify([
@ -300,15 +317,18 @@ export default function ({ getService }: FtrProviderContext) {
});
});
});
});
describe('searching for special characters', () => {
before(() => esArchiver.load('saved_objects/find_edgecases'));
after(() => esArchiver.unload('saved_objects/find_edgecases'));
before(() =>
kibanaServer.importExport.load('saved_objects/find_edgecases', { space: SPACE_ID })
);
after(() =>
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',
@ -324,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',
@ -340,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',
@ -356,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',
@ -367,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']);
).to.eql(['some*visualization', 'my-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: [],
});
}));
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,
});
}));
});
});
});
}

View file

@ -12,19 +12,16 @@ 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');
});
describe('with kibana index', () => {
before(() => esArchiver.load('saved_objects/basic'));
after(() => esArchiver.unload('saved_objects/basic'));
after(() => kibanaServer.importExport.unload('saved_objects/basic'));
it('should return 200', async () =>
await supertest
@ -34,7 +31,7 @@ export default function ({ getService }: FtrProviderContext) {
expect(resp.body).to.eql({
id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab',
type: 'visualization',
updated_at: '2017-09-21T18:51:23.794Z',
updated_at: resp.body.updated_at,
version: resp.body.version,
migrationVersion: resp.body.migrationVersion,
coreMigrationVersion: KIBANA_VERSION,
@ -73,26 +70,4 @@ 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/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,
});
}));
});
});
}

View file

@ -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,10 +42,9 @@ export default function ({ getService }: FtrProviderContext) {
meta: { title: 'Requests', icon: 'dashboardApp' },
};
describe('with kibana index', () => {
describe('with basic data existing', () => {
before(() => esArchiver.load('saved_objects/basic'));
after(() => esArchiver.unload('saved_objects/basic'));
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
@ -237,5 +236,4 @@ export default function ({ getService }: FtrProviderContext) {
});
});
});
});
}

View file

@ -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,19 +22,21 @@ export default function ({ getService }: FtrProviderContext) {
});
describe('with kibana index', () => {
before(() => esArchiver.load('saved_objects/basic'));
after(() => esArchiver.unload('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,
@ -76,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,
});
}));
});
});
}

View file

@ -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,224 +31,18 @@ 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*')
);
it('should return 200 and import nothing when empty parameters are passed in', 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 with internal server errors', async () => {
await supertest
.post('/api/saved_objects/_resolve_import_errors')
.field(
'retries',
JSON.stringify([
{
type: 'index-pattern',
id: '91200a00-9efd-11e7-acb3-3dab96693fab',
overwrite: true,
},
{
type: 'visualization',
id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab',
overwrite: true,
},
{
type: 'dashboard',
id: 'be3733a0-9efe-11e7-acb3-3dab96693fab',
overwrite: true,
},
])
)
.attach('file', join(__dirname, '../../fixtures/import.ndjson'))
.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',
},
},
],
warnings: [],
});
});
});
it('should return 400 when no file passed in', 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')
.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 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 () => {
const objToInsert = {
id: '1',
type: 'visualization',
attributes: {
title: 'My favorite vis',
visState: '{}',
},
references: [
{
name: 'ref_0',
type: 'index-pattern',
id: '2',
},
],
};
await supertest
.post('/api/saved_objects/_resolve_import_errors')
.field(
'retries',
JSON.stringify([
{
type: 'visualization',
id: '1',
},
])
)
.attach('file', Buffer.from(JSON.stringify(objToInsert), 'utf8'), 'export.ndjson')
.expect(200)
.then((resp) => {
expect(resp.body).to.eql({
success: false,
successCount: 0,
errors: [
{
id: '1',
type: 'visualization',
title: 'My favorite vis',
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('saved_objects/basic'));
after(() => esArchiver.unload('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 });
});
after(() => kibanaServer.spaces.delete(SPACE_ID));
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)
@ -260,7 +53,7 @@ export default function ({ getService }: FtrProviderContext) {
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([
@ -299,7 +92,7 @@ export default function ({ getService }: FtrProviderContext) {
it('should return 200 with only one record when overwriting 1 and skipping 1', async () => {
await supertest
.post('/api/saved_objects/_resolve_import_errors')
.post(`/s/${SPACE_ID}/api/saved_objects/_resolve_import_errors`)
.field(
'retries',
JSON.stringify([
@ -339,7 +132,7 @@ 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([
@ -373,7 +166,7 @@ export default function ({ getService }: FtrProviderContext) {
});
});
await supertest
.get('/api/saved_objects/visualization/1')
.get(`/s/${SPACE_ID}/api/saved_objects/visualization/1`)
.expect(200)
.then((resp) => {
expect(resp.body.references).to.eql([
@ -387,5 +180,4 @@ export default function ({ getService }: FtrProviderContext) {
});
});
});
});
}

View file

@ -11,13 +11,11 @@ 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('saved_objects/basic'));
after(() => esArchiver.unload('saved_objects/basic'));
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`)
@ -162,30 +160,4 @@ 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 500', async () =>
await supertest
.put(`/api/saved_objects/visualization/dd7caf20-9efd-11e7-acb3-3dab96693fab`)
.send({
attributes: {
title: 'My second favorite vis',
},
})
.expect(500)
.then((resp) => {
expect(resp.body).eql({
statusCode: 500,
error: 'Internal Server Error',
message: 'An internal server error occurred.',
});
}));
});
});
}

View file

@ -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,8 +25,8 @@ export default function ({ getService }: FtrProviderContext) {
});
describe('with kibana index', () => {
before(() => esArchiver.load('saved_objects/basic'));
after(() => esArchiver.unload('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
@ -86,8 +85,8 @@ export default function ({ getService }: FtrProviderContext) {
});
describe('`hasReference` and `hasReferenceOperator` parameters', () => {
before(() => esArchiver.load('saved_objects/references'));
after(() => esArchiver.unload('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
@ -119,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',
]);
});
});
@ -145,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('management/saved_objects/search'));
after(() => esArchiver.unload('management/saved_objects/search'));

View file

@ -11,17 +11,15 @@ 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('saved_objects/basic'));
after(() => esArchiver.unload('saved_objects/basic'));
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
@ -36,20 +34,6 @@ export default function ({ getService }: FtrProviderContext) {
}));
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));
});
await supertest.get(`/api/kibana/management/saved_objects/${nonexistentObject}`).expect(404));
});
}

View file

@ -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,12 +43,8 @@ export default function ({ getService }: FtrProviderContext) {
});
describe('relationships', () => {
before(async () => {
await esArchiver.load('management/saved_objects/relationships');
});
after(async () => {
await esArchiver.unload('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'];

View file

@ -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('saved_objects/basic'));
after(() => esArchiver.unload('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

View file

@ -44,11 +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('saved_objects/basic'));
after('cleanup saved objects changes', () => esArchiver.unload('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', () => {

View file

@ -8,16 +8,17 @@
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('index_patterns/basic_index');
await esArchiver.load('index_patterns/basic_kibana');
await kibanaServer.importExport.load('index_patterns/basic_kibana');
});
after(async () => {
await esArchiver.unload('index_patterns/basic_index');
await esArchiver.unload('index_patterns/basic_kibana');
await kibanaServer.importExport.unload('index_patterns/basic_kibana');
});
it('should return 200 with special characters', () =>

View file

@ -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',
],

View file

@ -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\"}}}]"
}
}
}
}

View file

@ -1,253 +0,0 @@
{
"type": "index",
"value": {
"index": ".kibana",
"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"
}
}
}
}
}
}
}

View file

@ -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"
}
]
}
}
}

View file

@ -1,297 +0,0 @@
{
"type": "index",
"value": {
"index": ".kibana",
"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"
}
}
}
}
}
}
}

View file

@ -1,253 +0,0 @@
{
"type": "index",
"value": {
"index": ".kibana",
"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"
}
}
}
}
}
}
}

View file

@ -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": []
}
}
}

View file

@ -1,267 +0,0 @@
{
"type": "index",
"value": {
"index": ".kibana",
"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"
}
}
}
}
}
}
}

View file

@ -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"
}
]
}
}
}

View file

@ -1,267 +0,0 @@
{
"type": "index",
"value": {
"index": ".kibana",
"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"
}
}
}
}
}
}
}

View file

@ -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="
}

View file

@ -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"
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -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="
}

View file

@ -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="
}

View file

@ -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('empty_kibana'));
after(() => esArchiver.unload('empty_kibana'));
describe('no auth', () => {
it('should return 401', async () => {
return supertestNoAuth