diff --git a/package.json b/package.json index b1a98b36fffc3..46c45506f98fc 100644 --- a/package.json +++ b/package.json @@ -274,6 +274,7 @@ "strip-ansi": "^3.0.1", "supertest": "3.0.0", "supertest-as-promised": "2.0.2", + "tmp": "0.0.31", "tree-kill": "1.1.0", "webpack-dev-server": "1.14.1" }, diff --git a/src/core_plugins/elasticsearch/lib/create_kibana_index.js b/src/core_plugins/elasticsearch/lib/create_kibana_index.js index 5a419646ca306..78c6c25b4eb38 100644 --- a/src/core_plugins/elasticsearch/lib/create_kibana_index.js +++ b/src/core_plugins/elasticsearch/lib/create_kibana_index.js @@ -6,8 +6,7 @@ export default function (server, mappings) { body: { settings: { number_of_shards: 1, - 'index.mapper.dynamic': false, - 'index.mapping.single_type': false + 'index.mapper.dynamic': false }, mappings } diff --git a/src/es_archiver/actions/index.js b/src/es_archiver/actions/index.js index 113cad141f62a..9cfdf51e488c8 100644 --- a/src/es_archiver/actions/index.js +++ b/src/es_archiver/actions/index.js @@ -2,3 +2,4 @@ export { saveAction } from './save'; export { loadAction } from './load'; export { unloadAction } from './unload'; export { rebuildAllAction } from './rebuild_all'; +export { reindexAction } from './reindex'; diff --git a/src/es_archiver/actions/load.js b/src/es_archiver/actions/load.js index ef96f14fdea63..21d55533c9f84 100644 --- a/src/es_archiver/actions/load.js +++ b/src/es_archiver/actions/load.js @@ -2,7 +2,7 @@ import { resolve } from 'path'; import { createReadStream } from 'fs'; import { - createPromiseFromStreams + createPromiseFromStreams, } from '../../utils'; import { @@ -13,9 +13,10 @@ import { createParseArchiveStreams, createCreateIndexStream, createIndexDocRecordsStream, + createConvertToV6Stream, } from '../lib'; -export async function loadAction({ name, skipExisting, client, dataDir, log }) { +export async function loadAction({ name, skipExisting, client, dataDir, log, convertToV6 }) { const inputDir = resolve(dataDir, name); const stats = createStats(name, log); @@ -26,6 +27,7 @@ export async function loadAction({ name, skipExisting, client, dataDir, log }) { await createPromiseFromStreams([ createReadStream(resolve(inputDir, filename)), ...createParseArchiveStreams({ gzip: isGzip(filename) }), + ...(convertToV6 ? [createConvertToV6Stream()] : []), createCreateIndexStream({ client, stats, skipExisting }), createIndexDocRecordsStream(client, stats), ]); diff --git a/src/es_archiver/actions/rebuild_all.js b/src/es_archiver/actions/rebuild_all.js index 2d6e36a38ec99..cb9a5cc71dee6 100644 --- a/src/es_archiver/actions/rebuild_all.js +++ b/src/es_archiver/actions/rebuild_all.js @@ -14,13 +14,15 @@ import { import { prioritizeMappings, readDirectory, + findArchiveNames, isGzip, createParseArchiveStreams, createFormatArchiveStreams, + createConvertToV6Stream, } from '../lib'; -export async function rebuildAllAction({ dataDir, log }) { - const archiveNames = await readDirectory(dataDir); +export async function rebuildAllAction({ dataDir, log, convertToV6 }) { + const archiveNames = await findArchiveNames(dataDir); for (const name of archiveNames) { const inputDir = resolve(dataDir, name); @@ -35,6 +37,7 @@ export async function rebuildAllAction({ dataDir, log }) { await createPromiseFromStreams([ createReadStream(path), ...createParseArchiveStreams({ gzip }), + ...(convertToV6 ? [createConvertToV6Stream()] : []), ...createFormatArchiveStreams({ gzip }), createWriteStream(tempFile), ]); diff --git a/src/es_archiver/actions/reindex.js b/src/es_archiver/actions/reindex.js new file mode 100644 index 0000000000000..8e8de1ca426bd --- /dev/null +++ b/src/es_archiver/actions/reindex.js @@ -0,0 +1,34 @@ +import tmp from 'tmp'; +import del from 'del'; + +import { saveAction } from './save'; +import { loadAction } from './load'; + +export async function reindexAction({ indices, client, log, convertToV6 }) { + const tmpDir = tmp.dirSync(); + const name = 'reindex'; + + try { + log.info('Saving indices to %j', tmpDir.name); + await saveAction({ + name, + indices, + client, + dataDir: tmpDir.name, + log, + }); + + log.info('Loading indices from %j', tmpDir.name); + await loadAction({ + name, + convertToV6, + skipExisting: false, + client, + dataDir: tmpDir.name, + log, + }); + } finally { + log.info('Cleaning up %j', tmpDir.name); + del.sync(tmpDir.name, { force: true }); + } +} diff --git a/src/es_archiver/cli.js b/src/es_archiver/cli.js index 0a8d6321c615a..e72031dba12ba 100644 --- a/src/es_archiver/cli.js +++ b/src/es_archiver/cli.js @@ -25,6 +25,7 @@ cmd .option('--es-url [url]', 'url for elasticsearch') .option(`--dir [path]`, 'where archives are stored') .option('--verbose', 'turn on verbose logging') + .option('--convert-to-v6', 'turn on automatic v6 conversion (true by default in `reindex` and `rebuild-all`)') .option('--config [path]', 'path to a functional test config file to use for default values', resolveConfigPath, defaultConfigPath) .on('--help', () => { console.log(readFileSync(resolve(__dirname, './cli_help.txt'), 'utf8')); @@ -36,7 +37,7 @@ cmd.command('save ') cmd.command('load ') .description('load the archive in --dir with ') - .action(name => execute('load', name)); + .action(name => execute('load', name, { convertToV6: cmd.convertToV6 })); cmd.command('unload ') .description('remove indices created by the archive in --dir with ') @@ -44,7 +45,11 @@ cmd.command('unload ') cmd.command('rebuild-all') .description('[internal] read and write all archives in --dir to remove any inconsistencies') - .action(() => execute('rebuildAll')); + .action(() => execute('rebuildAll', { convertToV6: cmd.convertToV6 })); + +cmd.command('reindex ') + .description('load the archive in --dir with ') + .action(indices => execute('reindex', indices, { convertToV6: cmd.convertToV6 })); cmd.parse(process.argv); diff --git a/src/es_archiver/es_archiver.js b/src/es_archiver/es_archiver.js index 07dd2bce7675f..99750ba32305a 100644 --- a/src/es_archiver/es_archiver.js +++ b/src/es_archiver/es_archiver.js @@ -3,6 +3,7 @@ import { loadAction, unloadAction, rebuildAllAction, + reindexAction, } from './actions'; export class EsArchiver { @@ -40,11 +41,15 @@ export class EsArchiver { * @return Promise */ async load(name, options = {}) { - const { skipExisting } = options; + const { + skipExisting = false, + convertToV6 = false + } = options; return await loadAction({ name, - skipExisting: !!skipExisting, + convertToV6, + skipExisting, client: this.client, dataDir: this.dataDir, log: this.log, @@ -72,11 +77,16 @@ export class EsArchiver { * * @return Promise */ - async rebuildAll() { + async rebuildAll(options = {}) { + const { + convertToV6 = true + } = options; + return rebuildAllAction({ + convertToV6, client: this.client, dataDir: this.dataDir, - log: this.log + log: this.log, }); } @@ -89,4 +99,17 @@ export class EsArchiver { async loadIfNeeded(name) { return this.load(name, { skipExisting: true }); } + + async reindex(indices, options = {}) { + const { + convertToV6 = true + } = options; + + return reindexAction({ + indices, + convertToV6, + client: this.client, + log: this.log + }); + } } diff --git a/src/es_archiver/lib/convert/index.js b/src/es_archiver/lib/convert/index.js new file mode 100644 index 0000000000000..7357b4aa06f52 --- /dev/null +++ b/src/es_archiver/lib/convert/index.js @@ -0,0 +1 @@ +export { createConvertToV6Stream } from './v5_to_v6'; diff --git a/src/es_archiver/lib/convert/v5_to_v6.js b/src/es_archiver/lib/convert/v5_to_v6.js new file mode 100644 index 0000000000000..2401602508a9a --- /dev/null +++ b/src/es_archiver/lib/convert/v5_to_v6.js @@ -0,0 +1,79 @@ +import { set, omit } from 'lodash'; + +import { + createMapStream, + getFlattenedObject, +} from '../../../utils'; + +export function createConvertToV6Stream() { + return createMapStream(record => { + switch (record.type) { + case 'index': { + const { index, settings, mappings } = record.value; + + // only convert kibana indices + if (index !== '.kibana') { + return record; + } + + // already v6 + if (typeof mappings.doc === 'object') { + return record; + } + + // settings can be dot-notated strings or nested objects + settings.index = getFlattenedObject(settings.index || {}); + delete settings.index['mapping.single_type']; + set(settings.index, 'mapper.dynamic', false); + + return { + type: 'index', + value: { + index, + settings, + mappings: { + doc: { + properties: { + type: { + type: 'keyword' + }, + ...omit(mappings, '_default_') + } + } + } + } + }; + } + + case 'doc': { + const { index, type, id, source } = record.value; + + // only convert kibana indices + if (index !== '.kibana') { + return record; + } + + if (type === 'doc' && source.type) { + // doc already v6 + return record; + } + + return { + type: 'doc', + value: { + index, + type: 'doc', + id: `${type}:${id}`, + source: { + type, + [type]: source + } + } + }; + } + + default: + return record; + } + }); +} diff --git a/src/es_archiver/lib/directory.js b/src/es_archiver/lib/directory.js index 872ca6a8df80b..ff1edb36ef1b6 100644 --- a/src/es_archiver/lib/directory.js +++ b/src/es_archiver/lib/directory.js @@ -1,8 +1,19 @@ import { readdir } from 'fs'; +import { dirname } from 'path'; +import glob from 'glob'; +import { uniq } from 'lodash'; import { fromNode } from 'bluebird'; export async function readDirectory(path) { const allNames = await fromNode(cb => readdir(path, cb)); return allNames.filter(name => !name.startsWith('.')); } + +// get the archives from a path. archives don't have to be direct children +// so this looks for any `.json` or `.gz` file and assumes that it's parent +// directory is an "archive" +export async function findArchiveNames(path) { + const dataFiles = await fromNode(cb => glob('**/*.{gz,json}', { cwd: path }, cb)); + return uniq(dataFiles.map(dataFile => dirname(dataFile))); +} diff --git a/src/es_archiver/lib/index.js b/src/es_archiver/lib/index.js index 0a70116fedab8..97bc47091e437 100644 --- a/src/es_archiver/lib/index.js +++ b/src/es_archiver/lib/index.js @@ -25,5 +25,10 @@ export { } from './archives'; export { - readDirectory + readDirectory, + findArchiveNames, } from './directory'; + +export { + createConvertToV6Stream, +} from './convert'; diff --git a/src/server/saved_objects/client/__tests__/saved_objects_client.js b/src/server/saved_objects/client/__tests__/saved_objects_client.js index 24dec0e7848c0..8b9852468a5a1 100644 --- a/src/server/saved_objects/client/__tests__/saved_objects_client.js +++ b/src/server/saved_objects/client/__tests__/saved_objects_client.js @@ -1,9 +1,10 @@ import expect from 'expect.js'; import sinon from 'sinon'; import { SavedObjectsClient } from '../saved_objects_client'; -import { createIdQuery } from '../lib/create_id_query'; describe('SavedObjectsClient', () => { + const sandbox = sinon.sandbox.create(); + let callAdminCluster; let savedObjectsClient; const docs = { @@ -11,61 +12,80 @@ describe('SavedObjectsClient', () => { total: 3, hits: [{ _index: '.kibana', - _type: 'index-pattern', - _id: 'logstash-*', + _type: 'doc', + _id: 'index-pattern:logstash-*', _score: 1, _source: { - title: 'logstash-*', - timeFieldName: '@timestamp', - notExpandable: true + type: 'index-pattern', + 'index-pattern': { + title: 'logstash-*', + timeFieldName: '@timestamp', + notExpandable: true + } } }, { _index: '.kibana', - _type: 'config', - _id: '6.0.0-alpha1', + _type: 'doc', + _id: 'config:6.0.0-alpha1', _score: 1, _source: { - buildNum: 8467, - defaultIndex: 'logstash-*' + type: 'config', + config: { + buildNum: 8467, + defaultIndex: 'logstash-*' + } } }, { _index: '.kibana', - _type: 'index-pattern', - _id: 'stocks-*', + _type: 'doc', + _id: 'index-pattern:stocks-*', _score: 1, _source: { - title: 'stocks-*', - timeFieldName: '@timestamp', - notExpandable: true + type: 'index-pattern', + 'index-pattern': { + title: 'stocks-*', + timeFieldName: '@timestamp', + notExpandable: true + } } }] } }; const mappings = { - 'index-pattern': { + doc: { properties: { - someField: { - type: 'keyword' + 'index-pattern': { + properties: { + someField: { + type: 'keyword' + } + } } } } }; beforeEach(() => { - callAdminCluster = sinon.mock(); + callAdminCluster = sandbox.stub(); savedObjectsClient = new SavedObjectsClient('.kibana-test', mappings, callAdminCluster); }); afterEach(() => { - callAdminCluster.reset(); + sandbox.restore(); }); describe('#create', () => { - it('formats Elasticsearch response', async () => { - callAdminCluster.returns({ _type: 'index-pattern', _id: 'logstash-*', _version: 2 }); + beforeEach(() => { + callAdminCluster.returns(Promise.resolve({ + _type: 'doc', + _id: 'index-pattern:logstash-*', + _version: 2 + })); + }); + it('formats Elasticsearch response', async () => { const response = await savedObjectsClient.create('index-pattern', { title: 'Logstash' }); @@ -81,8 +101,6 @@ describe('SavedObjectsClient', () => { }); it('should use ES index action', async () => { - callAdminCluster.returns({ _type: 'index-pattern', _id: 'logstash-*', _version: 2 }); - await savedObjectsClient.create('index-pattern', { id: 'logstash-*', title: 'Logstash' @@ -95,8 +113,6 @@ describe('SavedObjectsClient', () => { }); it('should use create action if ID defined and overwrite=false', async () => { - callAdminCluster.returns({ _type: 'index-pattern', _id: 'logstash-*', _version: 2 }); - await savedObjectsClient.create('index-pattern', { title: 'Logstash' }, { @@ -110,17 +126,25 @@ describe('SavedObjectsClient', () => { }); it('allows for id to be provided', async () => { - callAdminCluster.returns({ _type: 'index-pattern', _id: 'logstash-*', _version: 2 }); + await savedObjectsClient.create('index-pattern', { + title: 'Logstash' + }, { id: 'logstash-*' }); + + expect(callAdminCluster.calledOnce).to.be(true); + + const args = callAdminCluster.getCall(0).args; + expect(args[1].id).to.be('index-pattern:logstash-*'); + }); + it('self-generates an ID', async () => { await savedObjectsClient.create('index-pattern', { - id: 'logstash-*', title: 'Logstash' - }, { id: 'myId' }); + }); expect(callAdminCluster.calledOnce).to.be(true); const args = callAdminCluster.getCall(0).args; - expect(args[1].id).to.be('myId'); + expect(args[1].id).to.match(/index-pattern:[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}/); }); }); @@ -137,10 +161,10 @@ describe('SavedObjectsClient', () => { expect(args[0]).to.be('bulk'); expect(args[1].body).to.eql([ - { create: { _type: 'config', _id: 'one' } }, - { title: 'Test One' }, - { create: { _type: 'index-pattern', _id: 'two' } }, - { title: 'Test Two' } + { create: { _type: 'doc', _id: 'config:one' } }, + { type: 'config', config: { title: 'Test One' } }, + { create: { _type: 'doc', _id: 'index-pattern:two' } }, + { type: 'index-pattern', 'index-pattern': { title: 'Test Two' } } ]); }); @@ -156,10 +180,10 @@ describe('SavedObjectsClient', () => { expect(args[0]).to.be('bulk'); expect(args[1].body).to.eql([ - { index: { _type: 'config', _id: 'one' } }, - { title: 'Test One' }, - { index: { _type: 'index-pattern', _id: 'two' } }, - { title: 'Test Two' } + { index: { _type: 'doc', _id: 'config:one' } }, + { type: 'config', 'config': { title: 'Test One' } }, + { index: { _type: 'doc', _id: 'index-pattern:two' } }, + { type: 'index-pattern', 'index-pattern': { title: 'Test Two' } } ]); }); @@ -168,16 +192,16 @@ describe('SavedObjectsClient', () => { errors: false, items: [{ create: { - _type: 'config', - _id: 'one', + _type: 'doc', + _id: 'config:one', error: { reason: 'type[config] missing' } } }, { create: { - _type: 'index-pattern', - _id: 'two', + _type: 'doc', + _id: 'index-pattern:two', _version: 2 } }] @@ -210,14 +234,14 @@ describe('SavedObjectsClient', () => { errors: false, items: [{ create: { - _type: 'config', - _id: 'one', + _type: 'doc', + _id: 'config:one', _version: 2 } }, { create: { - _type: 'index-pattern', - _id: 'two', + _type: 'doc', + _id: 'index-pattern:two', _version: 2 } }] @@ -247,17 +271,16 @@ describe('SavedObjectsClient', () => { }); describe('#delete', () => { - it('throws notFound when ES is unable to find the document', (done) => { - callAdminCluster.returns(Promise.resolve({ - deleted: 0 - })); + it('throws notFound when ES is unable to find the document', async () => { + callAdminCluster.returns(Promise.resolve({ found: false })); + + try { + await savedObjectsClient.delete('index-pattern', 'logstash-*'); + expect().fail('should throw error'); + } catch(e) { + expect(e.output.statusCode).to.eql(404); + } - savedObjectsClient.delete('index-pattern', 'logstash-*').then(() => { - done('failed'); - }).catch(e => { - expect(e.output.statusCode).to.be(404); - done(); - }); }); it('passes the parameters to callAdminCluster', async () => { @@ -265,10 +288,11 @@ describe('SavedObjectsClient', () => { expect(callAdminCluster.calledOnce).to.be(true); - const args = callAdminCluster.getCall(0).args; - expect(args[0]).to.be('deleteByQuery'); - expect(args[1]).to.eql({ - body: createIdQuery({ type: 'index-pattern', id: 'logstash-*' }), + const [method, args] = callAdminCluster.getCall(0).args; + expect(method).to.be('delete'); + expect(args).to.eql({ + type: 'doc', + id: 'index-pattern:logstash-*', refresh: 'wait_for', index: '.kibana-test' }); @@ -284,12 +308,13 @@ describe('SavedObjectsClient', () => { expect(response.total).to.be(count); expect(response.saved_objects).to.have.length(count); + docs.hits.hits.forEach((doc, i) => { expect(response.saved_objects[i]).to.eql({ - id: doc._id, - type: doc._type, + id: doc._id.replace(/(index-pattern|config)\:/, ''), + type: doc._source.type, version: doc._version, - attributes: doc._source + attributes: doc._source[doc._source.type] }); }); }); @@ -391,17 +416,14 @@ describe('SavedObjectsClient', () => { describe('#get', () => { it('formats Elasticsearch response', async () => { callAdminCluster.returns(Promise.resolve({ - hits: { - hits: [ - { - _id: 'logstash-*', - _type: 'index-pattern', - _version: 2, - _source: { - title: 'Testing' - } - } - ] + _id: 'index-pattern:logstash-*', + _type: 'doc', + _version: 2, + _source: { + type: 'index-pattern', + 'index-pattern': { + title: 'Testing' + } } })); @@ -415,10 +437,19 @@ describe('SavedObjectsClient', () => { } }); }); + + it('prepends type to the id', async () => { + callAdminCluster.returns(Promise.resolve({})); + await savedObjectsClient.get('index-pattern', 'logstash-*'); + + const [, args] = callAdminCluster.getCall(0).args; + expect(args.id).to.eql('index-pattern:logstash-*'); + expect(args.type).to.eql('doc'); + }); }); describe('#bulkGet', () => { - it('accepts an array of mixed type and ids', async () => { + it('accepts a array of mixed type and ids', async () => { await savedObjectsClient.bulkGet([ { id: 'one', type: 'config' }, { id: 'two', type: 'index-pattern' } @@ -427,11 +458,9 @@ describe('SavedObjectsClient', () => { expect(callAdminCluster.calledOnce).to.be(true); const options = callAdminCluster.getCall(0).args[1]; - expect(options.body).to.eql([ - {}, - createIdQuery({ type: 'config', id: 'one' }), - {}, - createIdQuery({ type: 'index-pattern', id: 'two' }) + expect(options.body.docs).to.eql([ + { _type: 'doc', _id: 'config:one' }, + { _type: 'doc', _id: 'index-pattern:two' } ]); }); @@ -444,38 +473,35 @@ describe('SavedObjectsClient', () => { it('reports error on missed objects', async () => { callAdminCluster.returns(Promise.resolve({ - responses: [ - { - hits: { - hits: [ - { - _id: 'good', - _type: 'doc', - _version: 2, - _source: { - type: 'config', - config: { - title: 'Test' - } - } - } - ] - } - } - ] + docs:[{ + _type: 'doc', + _id: 'config:good', + found: true, + _version: 2, + _source: { config: { title: 'Test' } } + }, { + _type: 'doc', + _id: 'config:bad', + found: false + }] })); const { saved_objects: savedObjects } = await savedObjectsClient.bulkGet( [{ id: 'good', type: 'config' }, { id: 'bad', type: 'config' }] ); - expect(savedObjects).to.have.length(1); + expect(savedObjects).to.have.length(2); expect(savedObjects[0]).to.eql({ id: 'good', type: 'config', version: 2, attributes: { title: 'Test' } }); + expect(savedObjects[1]).to.eql({ + id: 'bad', + type: 'config', + error: { statusCode: 404, message: 'Not found' } + }); }); }); @@ -487,8 +513,8 @@ describe('SavedObjectsClient', () => { const attributes = { title: 'Testing' }; callAdminCluster.returns(Promise.resolve({ - _id: id, - _type: type, + _id: `${type}:${id}`, + _type: 'doc', _version: version, result: 'updated' })); @@ -523,10 +549,10 @@ describe('SavedObjectsClient', () => { expect(args[0]).to.be('update'); expect(args[1]).to.eql({ - type: 'index-pattern', - id: 'logstash-*', + type: 'doc', + id: 'index-pattern:logstash-*', version: undefined, - body: { doc: { title: 'Testing' } }, + body: { doc: { 'index-pattern': { title: 'Testing' } } }, refresh: 'wait_for', index: '.kibana-test' }); diff --git a/src/server/saved_objects/client/__tests__/saved_objects_client_mappings.js b/src/server/saved_objects/client/__tests__/saved_objects_client_mappings.js deleted file mode 100644 index 19ef0d9f84aa9..0000000000000 --- a/src/server/saved_objects/client/__tests__/saved_objects_client_mappings.js +++ /dev/null @@ -1,155 +0,0 @@ -import elasticsearch from 'elasticsearch'; -import expect from 'expect.js'; -import sinon from 'sinon'; - -import { SavedObjectsClient } from '../saved_objects_client'; -const { BadRequest } = elasticsearch.errors; - -describe('SavedObjectsClient', () => { - let callAdminCluster; - let savedObjectsClient; - const illegalArgumentException = { - type: 'illegal_argument_exception', - reason: 'Rejecting mapping update to [.kibana-v6] as the final mapping would have more than 1 type: [doc, foo]' - }; - - describe('mapping', () => { - beforeEach(() => { - callAdminCluster = sinon.stub(); - savedObjectsClient = new SavedObjectsClient('.kibana-test', {}, callAdminCluster); - }); - - afterEach(() => { - callAdminCluster.reset(); - }); - - - describe('#create', () => { - it('falls back to v6 mapping', async () => { - const error = new BadRequest('[illegal_argument_exception] Rejecting mapping update to [.kibana-v6]', { - body: { - error: illegalArgumentException - } - }); - - callAdminCluster - .onFirstCall().throws(error) - .onSecondCall().returns(Promise.resolve({ _type: 'index-pattern', _id: 'logstash-*', _version: 2 })); - - const response = await savedObjectsClient.create('index-pattern', { - title: 'Logstash' - }); - - expect(response).to.eql({ - type: 'index-pattern', - id: 'logstash-*', - version: 2, - attributes: { - title: 'Logstash', - } - }); - }); - }); - - describe('#bulkCreate', () => { - it('falls back to v6 mappings', async () => { - const firstResponse = { - errors: true, - items: [{ - create: { - _type: 'config', - _id: 'one', - _version: 2, - status: 400, - error: illegalArgumentException - } - }, { - create: { - _type: 'index-pattern', - _id: 'two', - _version: 2, - status: 400, - error: illegalArgumentException - } - }] - }; - - const secondResponse = { - errors: false, - items: [{ - create: { - _type: 'config', - _id: 'one', - _version: 2 - } - }, { - create: { - _type: 'index-pattern', - _id: 'two', - _version: 2 - } - }] - }; - - callAdminCluster - .onFirstCall().returns(Promise.resolve(firstResponse)) - .onSecondCall().returns(Promise.resolve(secondResponse)); - - const response = await savedObjectsClient.bulkCreate([ - { type: 'config', id: 'one', attributes: { title: 'Test One' } }, - { type: 'index-pattern', id: 'two', attributes: { title: 'Test Two' } } - ]); - - expect(response).to.eql([ - { - id: 'one', - type: 'config', - version: 2, - attributes: { title: 'Test One' }, - error: undefined - }, { - id: 'two', - type: 'index-pattern', - version: 2, - attributes: { title: 'Test Two' }, - error: undefined - } - ]); - }); - }); - - describe('update', () => { - it('falls back to v6 mappings', async () => { - const id = 'logstash-*'; - const type = 'index-pattern'; - const version = 2; - const attributes = { title: 'Testing' }; - - const error = new BadRequest('[document_missing_exception] [config][logstash-*]: document missing', { - body: { - error: { - type: 'document_missing_exception' - } - } - }); - - callAdminCluster - .onFirstCall().throws(error) - .onSecondCall().returns(Promise.resolve({ - _id: id, - _type: type, - _version: version, - result: 'updated' - })); - - const response = await savedObjectsClient.update('index-pattern', 'logstash-*', attributes); - expect(response).to.eql({ - id, - type, - version, - attributes - }); - }); - }); - }); -}); diff --git a/src/server/saved_objects/client/lib/__tests__/compatibility.js b/src/server/saved_objects/client/lib/__tests__/compatibility.js deleted file mode 100644 index 33322e5320460..0000000000000 --- a/src/server/saved_objects/client/lib/__tests__/compatibility.js +++ /dev/null @@ -1,53 +0,0 @@ -import expect from 'expect.js'; -import { v5BulkCreate, v6BulkCreate } from '../compatibility'; - -describe('compatibility', () => { - const testObjects = [ - { type: 'index-pattern', id: 'one', attributes: { title: 'Test Index Pattern' } }, - { type: 'config', id: 'two', attributes: { title: 'Test Config Value' } } - ]; - - describe('v5BulkCreate', () => { - it('handles default options', () => { - const objects = v5BulkCreate(testObjects); - expect(objects).to.eql([ - { create: { _type: 'index-pattern', _id: 'one' } }, - { title: 'Test Index Pattern' }, - { create: { _type: 'config', _id: 'two' } }, - { title: 'Test Config Value' } - ]); - }); - - it('uses index action for options.overwrite=true', () => { - const objects = v5BulkCreate(testObjects, { overwrite: true }); - expect(objects).to.eql([ - { index: { _type: 'index-pattern', _id: 'one' } }, - { title: 'Test Index Pattern' }, - { index: { _type: 'config', _id: 'two' } }, - { title: 'Test Config Value' } - ]); - }); - }); - - describe('v6BulkCreate', () => { - it('handles default options', () => { - const objects = v6BulkCreate(testObjects); - expect(objects).to.eql([ - { create: { _type: 'doc', _id: 'index-pattern:one' } }, - { type: 'index-pattern', 'index-pattern': { title: 'Test Index Pattern' } }, - { create: { _type: 'doc', _id: 'config:two' } }, - { type: 'config', config: { title: 'Test Config Value' } } - ]); - }); - - it('uses index action for options.overwrite=true', () => { - const objects = v6BulkCreate(testObjects, { overwrite: true }); - expect(objects).to.eql([ - { index: { _type: 'doc', _id: 'index-pattern:one' } }, - { type: 'index-pattern', 'index-pattern': { title: 'Test Index Pattern' } }, - { index: { _type: 'doc', _id: 'config:two' } }, - { type: 'config', config: { title: 'Test Config Value' } } - ]); - }); - }); -}); diff --git a/src/server/saved_objects/client/lib/__tests__/create_id_query.js b/src/server/saved_objects/client/lib/__tests__/create_id_query.js deleted file mode 100644 index 735e17743baeb..0000000000000 --- a/src/server/saved_objects/client/lib/__tests__/create_id_query.js +++ /dev/null @@ -1,48 +0,0 @@ -import expect from 'expect.js'; -import { createIdQuery } from '../create_id_query'; - -describe('createIdQuery', () => { - it('takes an id and type', () => { - const query = createIdQuery({ id: 'foo', type: 'bar' }); - - const expectedQuery = { - version: true, - size: 1, - query: { - bool: { - should: [ - // v5 document - { - bool: { - must: [ - { term: { _id: 'foo' } }, - { term: { _type: 'bar' } } - ] - } - }, - // migrated v5 document - { - bool: { - must: [ - { term: { _id: 'bar:foo' } }, - { term: { type: 'bar' } } - ] - } - }, - // v6 document - { - bool: { - must: [ - { term: { _id: 'foo' } }, - { term: { type: 'bar' } } - ] - } - }, - ] - } - } - }; - - expect(query).to.eql(expectedQuery); - }); -}); diff --git a/src/server/saved_objects/client/lib/compatibility.js b/src/server/saved_objects/client/lib/compatibility.js deleted file mode 100644 index 3d78bf19c2105..0000000000000 --- a/src/server/saved_objects/client/lib/compatibility.js +++ /dev/null @@ -1,42 +0,0 @@ -import { V6_TYPE } from '../saved_objects_client'; - -/** - * @param {array} objects - [{ type, id, attributes }] - * @param {object} [options={}] - * @property {boolean} [options.overwrite=false] - overrides existing documents - * @returns {array} - */ -export function v5BulkCreate(objects, options = {}) { - return objects.reduce((acc, object) => { - const method = object.id && !options.overwrite ? 'create' : 'index'; - - acc.push({ [method]: { _type: object.type, _id: object.id } }); - acc.push(object.attributes); - - return acc; - }, []); -} - -/** - * @param {array} objects - [{ type, id, attributes }] - * @param {object} [options={}] - * @property {boolean} [options.overwrite=false] - overrides existing documents - * @returns {array} - */ -export function v6BulkCreate(objects, options = {}) { - return objects.reduce((acc, object) => { - const method = object.id && !options.overwrite ? 'create' : 'index'; - - acc.push({ [method]: { - _type: V6_TYPE, - _id: object.id ? `${object.type}:${object.id}` : undefined - } }); - - acc.push(Object.assign({}, - { type: object.type }, - { [object.type]: object.attributes } - )); - - return acc; - }, []); -} diff --git a/src/server/saved_objects/client/lib/create_find_query.js b/src/server/saved_objects/client/lib/create_find_query.js index 8cb6db72216ec..f75bac202ff63 100644 --- a/src/server/saved_objects/client/lib/create_find_query.js +++ b/src/server/saved_objects/client/lib/create_find_query.js @@ -1,4 +1,6 @@ import { get } from 'lodash'; +import { V6_TYPE } from '../saved_objects_client'; + export function createFindQuery(mappings, options = {}) { const { type, search, searchFields, sortField, sortOrder } = options; @@ -56,7 +58,7 @@ export function createFindQuery(mappings, options = {}) { if (sortField) { const value = { order: sortOrder, - unmapped_type: get(mappings, [type, 'properties', sortField, 'type']) + unmapped_type: get(mappings, [V6_TYPE, 'properties', type, 'properties', sortField, 'type']) }; query.sort = [{ diff --git a/src/server/saved_objects/client/lib/create_id_query.js b/src/server/saved_objects/client/lib/create_id_query.js deleted file mode 100644 index 359adb39ccb64..0000000000000 --- a/src/server/saved_objects/client/lib/create_id_query.js +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Finds a document by either its v5 or v6 format - * - * @param type The documents type - * @param id The documents id or legacy id -**/ -export function createIdQuery({ type, id }) { - return { - version: true, - size: 1, - query: { - bool: { - should: [ - // v5 document - { - bool: { - must: [ - { term: { _id: id } }, - { term: { _type: type } } - ] - } - }, - // migrated v5 document - { - bool: { - must: [ - { term: { _id: `${type}:${id}` } }, - { term: { type: type } } - ] - } - }, - // v6 document - { - bool: { - must: [ - { term: { _id: id } }, - { term: { type: type } } - ] - } - }, - ] - } - } - }; -} diff --git a/src/server/saved_objects/client/lib/handle_es_error.js b/src/server/saved_objects/client/lib/handle_es_error.js index 725d954a1ac61..87bdcf44841b0 100644 --- a/src/server/saved_objects/client/lib/handle_es_error.js +++ b/src/server/saved_objects/client/lib/handle_es_error.js @@ -13,13 +13,6 @@ const { BadRequest } = elasticsearch.errors; -export function isSingleTypeError(error) { - if (!error) return; - - return error.type === 'illegal_argument_exception' && - error.reason.match(/the final mapping would have more than 1 type/); -} - export function handleEsError(error) { if (!(error instanceof Error)) { throw new Error('Expected an instance of Error'); @@ -50,10 +43,6 @@ export function handleEsError(error) { } if (error instanceof BadRequest) { - if (isSingleTypeError(get(error, 'body.error'))) { - details.type = 'is_single_type'; - } - throw Boom.badRequest(reason, details); } diff --git a/src/server/saved_objects/client/lib/index.js b/src/server/saved_objects/client/lib/index.js index f5973cdc01428..62fd63889aab8 100644 --- a/src/server/saved_objects/client/lib/index.js +++ b/src/server/saved_objects/client/lib/index.js @@ -1,6 +1,4 @@ export { createFindQuery } from './create_find_query'; -export { createIdQuery } from './create_id_query'; -export { handleEsError, isSingleTypeError } from './handle_es_error'; -export { v5BulkCreate, v6BulkCreate } from './compatibility'; +export { handleEsError } from './handle_es_error'; export { normalizeEsDoc } from './normalize_es_doc'; export { includedFields } from './included_fields'; diff --git a/src/server/saved_objects/client/saved_objects_client.js b/src/server/saved_objects/client/saved_objects_client.js index 578c3281dbdc0..0de5b959418ac 100644 --- a/src/server/saved_objects/client/saved_objects_client.js +++ b/src/server/saved_objects/client/saved_objects_client.js @@ -1,13 +1,10 @@ import Boom from 'boom'; +import uuid from 'uuid'; import { get } from 'lodash'; import { createFindQuery, - createIdQuery, handleEsError, - isSingleTypeError, - v5BulkCreate, - v6BulkCreate, normalizeEsDoc, includedFields } from './lib'; @@ -33,18 +30,14 @@ export class SavedObjectsClient { */ async create(type, attributes = {}, options = {}) { const method = options.id && !options.overwrite ? 'create' : 'index'; - const response = await this._withKibanaIndexAndMappingFallback(method, { - type, - id: options.id, - body: attributes, - refresh: 'wait_for' - }, { + const response = await this._withKibanaIndex(method, { type: V6_TYPE, - id: options.id ? `${type}:${options.id}` : undefined, + id: this._generateEsId(type, options.id), body: { type, [type]: attributes - } + }, + refresh: 'wait_for' }); return normalizeEsDoc(response, { type, attributes }); @@ -56,29 +49,29 @@ export class SavedObjectsClient { * @param {array} objects - [{ type, id, attributes }] * @param {object} [options={}] * @property {boolean} [options.force=false] - overrides existing documents - * @property {string} [options.format=v5] * @returns {promise} - [{ id, type, version, attributes, error: { message } }] */ async bulkCreate(objects, options = {}) { - const { format = 'v5' } = options; + const body = objects.reduce((acc, object) => { + const method = object.id && !options.overwrite ? 'create' : 'index'; - const bulkCreate = format === 'v5' ? v5BulkCreate : v6BulkCreate; - const response = await this._withKibanaIndex('bulk', { - body: bulkCreate(objects, options), - refresh: 'wait_for' - }); + acc.push({ [method]: { + _type: V6_TYPE, + _id: this._generateEsId(object.type, object.id) + } }); - const items = get(response, 'items', []); - const missingTypesCount = items.filter(item => { - const method = Object.keys(item)[0]; - return isSingleTypeError(get(item, `${method}.error`)); - }).length; + acc.push(Object.assign({}, + { type: object.type }, + { [object.type]: object.attributes } + )); - const formatFallback = format === 'v5' && items.length > 0 && items.length === missingTypesCount; + return acc; + }, []); - if (formatFallback) { - return this.bulkCreate(objects, Object.assign({}, options, { format: 'v6' })); - } + const response = await this._withKibanaIndex('bulk', { + body, + refresh: 'wait_for' + }); return get(response, 'items', []).map((resp, i) => { const method = Object.keys(resp)[0]; @@ -101,12 +94,13 @@ export class SavedObjectsClient { * @returns {promise} */ async delete(type, id) { - const response = await this._withKibanaIndex('deleteByQuery', { - body: createIdQuery({ type, id }), + const response = await this._withKibanaIndex('delete', { + type: V6_TYPE, + id: this._generateEsId(type, id), refresh: 'wait_for' }); - if (get(response, 'deleted') === 0) { + if (get(response, 'found') === false) { throw Boom.notFound(); } } @@ -173,24 +167,22 @@ export class SavedObjectsClient { return { saved_objects: [] }; } - const docs = objects.reduce((acc, { type, id }) => { - return [...acc, {}, createIdQuery({ type, id })]; - }, []); + const docs = objects.map(doc => { + return { _type: V6_TYPE, _id: this._generateEsId(doc.type, doc.id) }; + }); - const response = await this._withKibanaIndex('msearch', { body: docs }); - const responses = get(response, 'responses', []); + const response = await this._withKibanaIndex('mget', { body: { docs } }) + .then(resp => get(resp, 'docs', [])); return { - saved_objects: responses.map((r, i) => { - const [hit] = get(r, 'hits.hits', []); - - if (!hit) { + saved_objects: response.map((r, i) => { + if (r.found === false) { return Object.assign({}, objects[i], { error: { statusCode: 404, message: 'Not found' } }); } - return normalizeEsDoc(hit, objects[i]); + return normalizeEsDoc(r, objects[i]); }) }; } @@ -203,14 +195,12 @@ export class SavedObjectsClient { * @returns {promise} - { id, type, version, attributes } */ async get(type, id) { - const response = await this._withKibanaIndex('search', { body: createIdQuery({ type, id }) }); - const [hit] = get(response, 'hits.hits', []); - - if (!hit) { - throw Boom.notFound(); - } + const response = await this._withKibanaIndex('get', { + type: V6_TYPE, + id: this._generateEsId(type, id) + }); - return normalizeEsDoc(hit); + return normalizeEsDoc(response); } /** @@ -223,40 +213,19 @@ export class SavedObjectsClient { * @returns {promise} */ async update(type, id, attributes, options = {}) { - const response = await this._withKibanaIndexAndMappingFallback('update', { - id, - type, - version: options.version, - refresh: 'wait_for', - body: { - doc: attributes - } - }, { + const response = await this._withKibanaIndex('update', { type: V6_TYPE, + id: this._generateEsId(type, id), + version: options.version, body: { doc: { [type]: attributes } - } + }, + refresh: 'wait_for' }); - return normalizeEsDoc(response, { id, type, attributes }); - } - - _withKibanaIndexAndMappingFallback(method, params, fallbackParams) { - const fallbacks = { - 'create': ['is_single_type'], - 'index': ['is_single_type'], - 'update': ['document_missing_exception'] - }; - - return this._withKibanaIndex(method, params).catch(err => { - if (get(fallbacks, method, []).includes(get(err, 'data.type'))) { - return this._withKibanaIndex(method, Object.assign({}, params, fallbackParams)); - } - - throw err; - }); + return normalizeEsDoc(response, { type, id, attributes }); } async _withKibanaIndex(method, params) { @@ -269,4 +238,8 @@ export class SavedObjectsClient { throw handleEsError(err); } } + + _generateEsId(type, id) { + return `${type}:${id || uuid.v1()}`; + } } diff --git a/src/ui/__tests__/ui_mappings.js b/src/ui/__tests__/ui_mappings.js index 880e988d2412e..7952cf77e4da2 100644 --- a/src/ui/__tests__/ui_mappings.js +++ b/src/ui/__tests__/ui_mappings.js @@ -26,7 +26,7 @@ describe('UiExports', function () { }); const mappings = mappingsCollection.getCombined(); - expect(has(mappings, 'foo.properties.bar')).to.be(true); + expect(has(mappings, 'doc.properties.foo.properties.bar')).to.be(true); }); it('throws and includes the plugin id in the mapping conflict message', () => { diff --git a/src/ui/ui_mappings.js b/src/ui/ui_mappings.js index 812770ff9f01e..80fce984cfd80 100644 --- a/src/ui/ui_mappings.js +++ b/src/ui/ui_mappings.js @@ -3,8 +3,8 @@ import _ from 'lodash'; class MappingsCollection { constructor() { this._defaultMappings = { - '_default_': { - 'dynamic': 'strict' + type: { + type: 'keyword' }, config: { dynamic: true, @@ -19,7 +19,12 @@ class MappingsCollection { } getCombined = () => { - return this._currentMappings; + return { + doc: { + dynamic: false, + properties: this._currentMappings, + }, + }; } register = (newMappings, options = {}) => { diff --git a/test/api_integration/fixtures/es_archiver/index_patterns/basic_index/data.json.gz b/test/api_integration/fixtures/es_archiver/index_patterns/basic_index/data.json.gz index 57080f6a2a59d..51f3d08846d37 100644 Binary files a/test/api_integration/fixtures/es_archiver/index_patterns/basic_index/data.json.gz and b/test/api_integration/fixtures/es_archiver/index_patterns/basic_index/data.json.gz differ diff --git a/test/api_integration/fixtures/es_archiver/index_patterns/basic_index/mappings.json b/test/api_integration/fixtures/es_archiver/index_patterns/basic_index/mappings.json index b47c0a003a42e..5bbc3978c3c36 100644 --- a/test/api_integration/fixtures/es_archiver/index_patterns/basic_index/mappings.json +++ b/test/api_integration/fixtures/es_archiver/index_patterns/basic_index/mappings.json @@ -30,4 +30,4 @@ } } } -} +} \ No newline at end of file diff --git a/test/api_integration/fixtures/es_archiver/index_patterns/daily_index/data.json.gz b/test/api_integration/fixtures/es_archiver/index_patterns/daily_index/data.json.gz index 76668fdeb56f0..2e807e5c1fc31 100644 Binary files a/test/api_integration/fixtures/es_archiver/index_patterns/daily_index/data.json.gz and b/test/api_integration/fixtures/es_archiver/index_patterns/daily_index/data.json.gz differ diff --git a/test/api_integration/fixtures/es_archiver/index_patterns/daily_index/mappings.json b/test/api_integration/fixtures/es_archiver/index_patterns/daily_index/mappings.json index 077315f44903d..20a55d612dff8 100644 --- a/test/api_integration/fixtures/es_archiver/index_patterns/daily_index/mappings.json +++ b/test/api_integration/fixtures/es_archiver/index_patterns/daily_index/mappings.json @@ -46,4 +46,4 @@ } } } -} +} \ No newline at end of file diff --git a/test/api_integration/fixtures/es_archiver/index_patterns/time_based_indices/mappings.json b/test/api_integration/fixtures/es_archiver/index_patterns/time_based_indices/mappings.json index 87fdbfd488337..054e9a7c851be 100644 --- a/test/api_integration/fixtures/es_archiver/index_patterns/time_based_indices/mappings.json +++ b/test/api_integration/fixtures/es_archiver/index_patterns/time_based_indices/mappings.json @@ -121,4 +121,4 @@ } } } -} +} \ No newline at end of file diff --git a/test/api_integration/fixtures/es_archiver/search/count/data.json.gz b/test/api_integration/fixtures/es_archiver/search/count/data.json.gz index 39fb66e4d9392..e6fc50ad4f203 100644 Binary files a/test/api_integration/fixtures/es_archiver/search/count/data.json.gz and b/test/api_integration/fixtures/es_archiver/search/count/data.json.gz differ diff --git a/test/api_integration/fixtures/es_archiver/search/count/mappings.json b/test/api_integration/fixtures/es_archiver/search/count/mappings.json index f1d60cc32b156..011430cf843ce 100644 --- a/test/api_integration/fixtures/es_archiver/search/count/mappings.json +++ b/test/api_integration/fixtures/es_archiver/search/count/mappings.json @@ -4,242 +4,241 @@ "index": ".kibana", "settings": { "index": { - "mapping": { - "single_type": "false" - }, "number_of_shards": "1", - "mapper": { - "dynamic": "false" - }, + "mapper.dynamic": false, "number_of_replicas": "1" } }, "mappings": { - "url": { - "dynamic": "strict", + "doc": { "properties": { - "accessCount": { - "type": "long" - }, - "accessDate": { - "type": "date" - }, - "createDate": { - "type": "date" + "type": { + "type": "keyword" }, "url": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 2048 + "dynamic": "strict", + "properties": { + "accessCount": { + "type": "long" + }, + "accessDate": { + "type": "date" + }, + "createDate": { + "type": "date" + }, + "url": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 2048 + } + } } } - } - } - }, - "timelion-sheet": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" }, - "kibanaSavedObjectMeta": { + "timelion-sheet": { + "dynamic": "strict", "properties": { - "searchSourceJSON": { + "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" } } }, - "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" - } - } - }, - "_default_": { - "dynamic": "strict" - }, - "visualization": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "kibanaSavedObjectMeta": { + "visualization": { + "dynamic": "strict", "properties": { - "searchSourceJSON": { + "description": { + "type": "text" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" + } + } + }, + "savedSearchId": { + "type": "keyword" + }, + "title": { + "type": "text" + }, + "uiStateJSON": { + "type": "text" + }, + "version": { + "type": "integer" + }, + "visState": { "type": "text" } } }, - "savedSearchId": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - }, - "visState": { - "type": "text" - } - } - }, - "config": { - "dynamic": "true", - "properties": { - "buildNum": { - "type": "keyword" - } - } - }, - "search": { - "dynamic": "strict", - "properties": { - "columns": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "hits": { - "type": "integer" + "config": { + "dynamic": "true", + "properties": { + "buildNum": { + "type": "keyword" + } + } }, - "kibanaSavedObjectMeta": { + "search": { + "dynamic": "strict", "properties": { - "searchSourceJSON": { + "columns": { + "type": "keyword" + }, + "description": { + "type": "text" + }, + "hits": { + "type": "integer" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" + } + } + }, + "sort": { + "type": "keyword" + }, + "title": { "type": "text" + }, + "version": { + "type": "integer" } } }, - "sort": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "index-pattern": { - "dynamic": "strict", - "properties": { - "fieldFormatMap": { - "type": "text" - }, - "fields": { - "type": "text" - }, - "intervalName": { - "type": "keyword" - }, - "notExpandable": { - "type": "boolean" - }, - "sourceFilters": { - "type": "text" - }, - "timeFieldName": { - "type": "keyword" - }, - "title": { - "type": "text" - } - } - }, - "dashboard": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { + "index-pattern": { + "dynamic": "strict", "properties": { - "searchSourceJSON": { + "fieldFormatMap": { + "type": "text" + }, + "fields": { + "type": "text" + }, + "intervalName": { + "type": "keyword" + }, + "notExpandable": { + "type": "boolean" + }, + "sourceFilters": { + "type": "text" + }, + "timeFieldName": { + "type": "keyword" + }, + "title": { "type": "text" } } }, - "optionsJSON": { - "type": "text" - }, - "panelsJSON": { - "type": "text" - }, - "refreshInterval": { + "dashboard": { + "dynamic": "strict", "properties": { - "display": { + "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" }, - "pause": { + "timeRestore": { "type": "boolean" }, - "section": { - "type": "integer" + "timeTo": { + "type": "keyword" }, - "value": { + "title": { + "type": "text" + }, + "uiStateJSON": { + "type": "text" + }, + "version": { "type": "integer" } } }, - "timeFrom": { - "type": "keyword" - }, - "timeRestore": { - "type": "boolean" - }, - "timeTo": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "server": { - "dynamic": "strict", - "properties": { - "uuid": { - "type": "keyword" + "server": { + "dynamic": "strict", + "properties": { + "uuid": { + "type": "keyword" + } + } } } } diff --git a/test/common/services/kibana_server/ui_settings.js b/test/common/services/kibana_server/ui_settings.js index 7976b6c441ec4..ce0cebfb03679 100644 --- a/test/common/services/kibana_server/ui_settings.js +++ b/test/common/services/kibana_server/ui_settings.js @@ -11,8 +11,8 @@ export class KibanaServerUiSettings { const { kibanaVersion } = this; return { index: '.kibana', - type: 'config', - id: await kibanaVersion.get() + type: 'doc', + id: `config:${await kibanaVersion.get()}` }; } diff --git a/test/functional/fixtures/es_archiver/dashboard/data.json.gz b/test/functional/fixtures/es_archiver/dashboard/data.json.gz index 686be73b74c0b..583406fa4da4f 100644 Binary files a/test/functional/fixtures/es_archiver/dashboard/data.json.gz and b/test/functional/fixtures/es_archiver/dashboard/data.json.gz differ diff --git a/test/functional/fixtures/es_archiver/dashboard/mappings.json b/test/functional/fixtures/es_archiver/dashboard/mappings.json index 7a58ea71d5165..b8be6b1d280a5 100644 --- a/test/functional/fixtures/es_archiver/dashboard/mappings.json +++ b/test/functional/fixtures/es_archiver/dashboard/mappings.json @@ -4,244 +4,243 @@ "index": ".kibana", "settings": { "index": { - "mapping": { - "single_type": "false" - }, "number_of_shards": "1", - "mapper": { - "dynamic": "false" - }, + "mapper.dynamic": false, "number_of_replicas": "1" } }, "mappings": { - "index-pattern": { - "dynamic": "strict", + "doc": { "properties": { - "fieldFormatMap": { - "type": "text" - }, - "fields": { - "type": "text" - }, - "intervalName": { - "type": "keyword" - }, - "notExpandable": { - "type": "boolean" - }, - "sourceFilters": { - "type": "text" - }, - "timeFieldName": { + "type": { "type": "keyword" }, - "title": { - "type": "text" - } - } - }, - "search": { - "dynamic": "strict", - "properties": { - "columns": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { + "index-pattern": { + "dynamic": "strict", "properties": { - "searchSourceJSON": { + "fieldFormatMap": { + "type": "text" + }, + "fields": { + "type": "text" + }, + "intervalName": { + "type": "keyword" + }, + "notExpandable": { + "type": "boolean" + }, + "sourceFilters": { + "type": "text" + }, + "timeFieldName": { + "type": "keyword" + }, + "title": { "type": "text" } } }, - "sort": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "timelion-sheet": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { + "search": { + "dynamic": "strict", "properties": { - "searchSourceJSON": { + "columns": { + "type": "keyword" + }, + "description": { "type": "text" + }, + "hits": { + "type": "integer" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" + } + } + }, + "sort": { + "type": "keyword" + }, + "title": { + "type": "text" + }, + "version": { + "type": "integer" } } }, - "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" - } - } - }, - "server": { - "dynamic": "strict", - "properties": { - "uuid": { - "type": "keyword" - } - } - }, - "config": { - "dynamic": "true", - "properties": { - "buildNum": { - "type": "keyword" - } - } - }, - "dashboard": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { + "timelion-sheet": { + "dynamic": "strict", "properties": { - "searchSourceJSON": { + "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" } } }, - "optionsJSON": { - "type": "text" + "server": { + "dynamic": "strict", + "properties": { + "uuid": { + "type": "keyword" + } + } }, - "panelsJSON": { - "type": "text" + "config": { + "dynamic": "true", + "properties": { + "buildNum": { + "type": "keyword" + } + } }, - "refreshInterval": { + "dashboard": { + "dynamic": "strict", "properties": { - "display": { + "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" }, - "pause": { + "timeRestore": { "type": "boolean" }, - "section": { - "type": "integer" + "timeTo": { + "type": "keyword" }, - "value": { + "title": { + "type": "text" + }, + "uiStateJSON": { + "type": "text" + }, + "version": { "type": "integer" } } }, - "timeFrom": { - "type": "keyword" - }, - "timeRestore": { - "type": "boolean" - }, - "timeTo": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "visualization": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "kibanaSavedObjectMeta": { + "visualization": { + "dynamic": "strict", "properties": { - "searchSourceJSON": { + "description": { + "type": "text" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" + } + } + }, + "savedSearchId": { + "type": "keyword" + }, + "title": { + "type": "text" + }, + "uiStateJSON": { + "type": "text" + }, + "version": { + "type": "integer" + }, + "visState": { "type": "text" } } }, - "savedSearchId": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - }, - "visState": { - "type": "text" - } - } - }, - "url": { - "dynamic": "strict", - "properties": { - "accessCount": { - "type": "long" - }, - "accessDate": { - "type": "date" - }, - "createDate": { - "type": "date" - }, "url": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 2048 + "dynamic": "strict", + "properties": { + "accessCount": { + "type": "long" + }, + "accessDate": { + "type": "date" + }, + "createDate": { + "type": "date" + }, + "url": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 2048 + } + } } } } } - }, - "_default_": { - "dynamic": "strict" } } } diff --git a/test/functional/fixtures/es_archiver/discover/data.json.gz b/test/functional/fixtures/es_archiver/discover/data.json.gz index 662d73c9261b1..020ca814620a8 100644 Binary files a/test/functional/fixtures/es_archiver/discover/data.json.gz and b/test/functional/fixtures/es_archiver/discover/data.json.gz differ diff --git a/test/functional/fixtures/es_archiver/discover/mappings.json b/test/functional/fixtures/es_archiver/discover/mappings.json index 2710bf90b8d57..560178d1bc509 100644 --- a/test/functional/fixtures/es_archiver/discover/mappings.json +++ b/test/functional/fixtures/es_archiver/discover/mappings.json @@ -4,242 +4,241 @@ "index": ".kibana", "settings": { "index": { - "mapping": { - "single_type": "false" - }, "number_of_shards": "1", - "mapper": { - "dynamic": "false" - }, + "mapper.dynamic": false, "number_of_replicas": "1" } }, "mappings": { - "url": { - "dynamic": "strict", + "doc": { "properties": { - "accessCount": { - "type": "long" - }, - "accessDate": { - "type": "date" - }, - "createDate": { - "type": "date" + "type": { + "type": "keyword" }, "url": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 2048 + "dynamic": "strict", + "properties": { + "accessCount": { + "type": "long" + }, + "accessDate": { + "type": "date" + }, + "createDate": { + "type": "date" + }, + "url": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 2048 + } + } } } - } - } - }, - "index-pattern": { - "dynamic": "strict", - "properties": { - "fieldFormatMap": { - "type": "text" }, - "fields": { - "type": "text" - }, - "intervalName": { - "type": "keyword" - }, - "notExpandable": { - "type": "boolean" - }, - "sourceFilters": { - "type": "text" - }, - "timeFieldName": { - "type": "keyword" - }, - "title": { - "type": "text" - } - } - }, - "server": { - "dynamic": "strict", - "properties": { - "uuid": { - "type": "keyword" - } - } - }, - "dashboard": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { + "index-pattern": { + "dynamic": "strict", "properties": { - "searchSourceJSON": { + "fieldFormatMap": { + "type": "text" + }, + "fields": { + "type": "text" + }, + "intervalName": { + "type": "keyword" + }, + "notExpandable": { + "type": "boolean" + }, + "sourceFilters": { + "type": "text" + }, + "timeFieldName": { + "type": "keyword" + }, + "title": { "type": "text" } } }, - "optionsJSON": { - "type": "text" - }, - "panelsJSON": { - "type": "text" + "server": { + "dynamic": "strict", + "properties": { + "uuid": { + "type": "keyword" + } + } }, - "refreshInterval": { + "dashboard": { + "dynamic": "strict", "properties": { - "display": { + "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" }, - "pause": { + "timeRestore": { "type": "boolean" }, - "section": { - "type": "integer" + "timeTo": { + "type": "keyword" }, - "value": { + "title": { + "type": "text" + }, + "uiStateJSON": { + "type": "text" + }, + "version": { "type": "integer" } } }, - "timeFrom": { - "type": "keyword" - }, - "timeRestore": { - "type": "boolean" - }, - "timeTo": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "config": { - "dynamic": "true", - "properties": { - "buildNum": { - "type": "keyword" - } - } - }, - "visualization": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" + "config": { + "dynamic": "true", + "properties": { + "buildNum": { + "type": "keyword" + } + } }, - "kibanaSavedObjectMeta": { + "visualization": { + "dynamic": "strict", "properties": { - "searchSourceJSON": { + "description": { + "type": "text" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" + } + } + }, + "savedSearchId": { + "type": "keyword" + }, + "title": { + "type": "text" + }, + "uiStateJSON": { + "type": "text" + }, + "version": { + "type": "integer" + }, + "visState": { "type": "text" } } }, - "savedSearchId": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - }, - "visState": { - "type": "text" - } - } - }, - "_default_": { - "dynamic": "strict" - }, - "timelion-sheet": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { + "timelion-sheet": { + "dynamic": "strict", "properties": { - "searchSourceJSON": { + "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" } } }, - "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" - } - } - }, - "search": { - "dynamic": "strict", - "properties": { - "columns": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { + "search": { + "dynamic": "strict", "properties": { - "searchSourceJSON": { + "columns": { + "type": "keyword" + }, + "description": { + "type": "text" + }, + "hits": { + "type": "integer" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" + } + } + }, + "sort": { + "type": "keyword" + }, + "title": { "type": "text" + }, + "version": { + "type": "integer" } } - }, - "sort": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" } } } diff --git a/test/functional/fixtures/es_archiver/empty_kibana/data.json.gz b/test/functional/fixtures/es_archiver/empty_kibana/data.json.gz index d2eadfa1d04dd..bffef555b9bf3 100644 Binary files a/test/functional/fixtures/es_archiver/empty_kibana/data.json.gz and b/test/functional/fixtures/es_archiver/empty_kibana/data.json.gz differ diff --git a/test/functional/fixtures/es_archiver/empty_kibana/mappings.json b/test/functional/fixtures/es_archiver/empty_kibana/mappings.json index 4279c41b5a5cf..e100065d7d155 100644 --- a/test/functional/fixtures/es_archiver/empty_kibana/mappings.json +++ b/test/functional/fixtures/es_archiver/empty_kibana/mappings.json @@ -4,249 +4,248 @@ "index": ".kibana", "settings": { "index": { - "mapping": { - "single_type": "false" - }, "number_of_shards": "1", - "mapper": { - "dynamic": "false" - }, + "mapper.dynamic": false, "number_of_replicas": "1" } }, "mappings": { - "timelion-sheet": { - "dynamic": "strict", + "doc": { "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" + "type": { + "type": "keyword" }, - "kibanaSavedObjectMeta": { + "timelion-sheet": { + "dynamic": "strict", "properties": { - "searchSourceJSON": { + "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" } } }, - "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" - } - } - }, - "visualization": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "kibanaSavedObjectMeta": { + "visualization": { + "dynamic": "strict", "properties": { - "searchSourceJSON": { + "description": { + "type": "text" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" + } + } + }, + "savedSearchId": { + "type": "keyword" + }, + "title": { + "type": "text" + }, + "uiStateJSON": { + "type": "text" + }, + "version": { + "type": "integer" + }, + "visState": { "type": "text" } } }, - "savedSearchId": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - }, - "visState": { - "type": "text" - } - } - }, - "search": { - "dynamic": "strict", - "properties": { - "columns": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { + "search": { + "dynamic": "strict", "properties": { - "searchSourceJSON": { + "columns": { + "type": "keyword" + }, + "description": { + "type": "text" + }, + "hits": { + "type": "integer" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" + } + } + }, + "sort": { + "type": "keyword" + }, + "title": { "type": "text" + }, + "version": { + "type": "integer" } } }, - "sort": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "url": { - "dynamic": "strict", - "properties": { - "accessCount": { - "type": "long" - }, - "accessDate": { - "type": "date" - }, - "createDate": { - "type": "date" - }, "url": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 2048 + "dynamic": "strict", + "properties": { + "accessCount": { + "type": "long" + }, + "accessDate": { + "type": "date" + }, + "createDate": { + "type": "date" + }, + "url": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 2048 + } + } } } - } - } - }, - "_default_": { - "dynamic": "strict" - }, - "index-pattern": { - "dynamic": "strict", - "properties": { - "fieldFormatMap": { - "type": "text" }, - "fields": { - "type": "text" - }, - "intervalName": { - "type": "keyword" - }, - "notExpandable": { - "type": "boolean" - }, - "sourceFilters": { - "type": "text" - }, - "timeFieldName": { - "type": "keyword" - }, - "title": { - "type": "text" - } - } - }, - "dashboard": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { + "index-pattern": { + "dynamic": "strict", "properties": { - "searchSourceJSON": { + "fieldFormatMap": { + "type": "text" + }, + "fields": { + "type": "text" + }, + "intervalName": { + "type": "keyword" + }, + "notExpandable": { + "type": "boolean" + }, + "sourceFilters": { + "type": "text" + }, + "timeFieldName": { + "type": "keyword" + }, + "title": { "type": "text" } } }, - "optionsJSON": { - "type": "text" - }, - "panelsJSON": { - "type": "text" - }, - "refreshInterval": { + "dashboard": { + "dynamic": "strict", "properties": { - "display": { + "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" }, - "pause": { + "timeRestore": { "type": "boolean" }, - "section": { - "type": "integer" + "timeTo": { + "type": "keyword" + }, + "title": { + "type": "text" + }, + "uiStateJSON": { + "type": "text" }, - "value": { + "version": { "type": "integer" } } }, - "timeFrom": { - "type": "keyword" - }, - "timeRestore": { - "type": "boolean" - }, - "timeTo": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "server": { - "dynamic": "strict", - "properties": { - "uuid": { - "type": "keyword" - } - } - }, - "config": { - "dynamic": "true", - "properties": { - "buildNum": { - "type": "keyword" + "server": { + "dynamic": "strict", + "properties": { + "uuid": { + "type": "keyword" + } + } }, - "dateFormat:tz": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + "config": { + "dynamic": "true", + "properties": { + "buildNum": { + "type": "keyword" + }, + "dateFormat:tz": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } } } } diff --git a/test/functional/fixtures/es_archiver/logstash_functional/data.json.gz b/test/functional/fixtures/es_archiver/logstash_functional/data.json.gz index 44ce898062a99..075f0394f84e2 100644 Binary files a/test/functional/fixtures/es_archiver/logstash_functional/data.json.gz and b/test/functional/fixtures/es_archiver/logstash_functional/data.json.gz differ diff --git a/test/functional/fixtures/es_archiver/makelogs/data.json.gz b/test/functional/fixtures/es_archiver/makelogs/data.json.gz index 98409da09cb46..fd00aa63d23f1 100644 Binary files a/test/functional/fixtures/es_archiver/makelogs/data.json.gz and b/test/functional/fixtures/es_archiver/makelogs/data.json.gz differ diff --git a/test/functional/fixtures/es_archiver/visualize/data.json.gz b/test/functional/fixtures/es_archiver/visualize/data.json.gz index 3e1c28feee965..94b6c2a37efb9 100644 Binary files a/test/functional/fixtures/es_archiver/visualize/data.json.gz and b/test/functional/fixtures/es_archiver/visualize/data.json.gz differ diff --git a/test/functional/fixtures/es_archiver/visualize/mappings.json b/test/functional/fixtures/es_archiver/visualize/mappings.json index 1d12de0d45aaa..37ba6e6a3b135 100644 --- a/test/functional/fixtures/es_archiver/visualize/mappings.json +++ b/test/functional/fixtures/es_archiver/visualize/mappings.json @@ -4,242 +4,241 @@ "index": ".kibana", "settings": { "index": { - "mapping": { - "single_type": "false" - }, "number_of_shards": "1", - "mapper": { - "dynamic": "false" - }, + "mapper.dynamic": false, "number_of_replicas": "1" } }, "mappings": { - "server": { - "dynamic": "strict", + "doc": { "properties": { - "uuid": { + "type": { "type": "keyword" - } - } - }, - "url": { - "dynamic": "strict", - "properties": { - "accessCount": { - "type": "long" }, - "accessDate": { - "type": "date" - }, - "createDate": { - "type": "date" + "server": { + "dynamic": "strict", + "properties": { + "uuid": { + "type": "keyword" + } + } }, "url": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 2048 + "dynamic": "strict", + "properties": { + "accessCount": { + "type": "long" + }, + "accessDate": { + "type": "date" + }, + "createDate": { + "type": "date" + }, + "url": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 2048 + } + } } } - } - } - }, - "search": { - "dynamic": "strict", - "properties": { - "columns": { - "type": "keyword" - }, - "description": { - "type": "text" }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { + "search": { + "dynamic": "strict", "properties": { - "searchSourceJSON": { + "columns": { + "type": "keyword" + }, + "description": { "type": "text" + }, + "hits": { + "type": "integer" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" + } + } + }, + "sort": { + "type": "keyword" + }, + "title": { + "type": "text" + }, + "version": { + "type": "integer" } } }, - "sort": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "visualization": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "kibanaSavedObjectMeta": { + "visualization": { + "dynamic": "strict", "properties": { - "searchSourceJSON": { + "description": { + "type": "text" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" + } + } + }, + "savedSearchId": { + "type": "keyword" + }, + "title": { + "type": "text" + }, + "uiStateJSON": { + "type": "text" + }, + "version": { + "type": "integer" + }, + "visState": { "type": "text" } } }, - "savedSearchId": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - }, - "visState": { - "type": "text" - } - } - }, - "index-pattern": { - "dynamic": "strict", - "properties": { - "fieldFormatMap": { - "type": "text" - }, - "fields": { - "type": "text" - }, - "intervalName": { - "type": "keyword" - }, - "notExpandable": { - "type": "boolean" - }, - "sourceFilters": { - "type": "text" - }, - "timeFieldName": { - "type": "keyword" - }, - "title": { - "type": "text" - } - } - }, - "_default_": { - "dynamic": "strict" - }, - "config": { - "dynamic": "true", - "properties": { - "buildNum": { - "type": "keyword" - } - } - }, - "dashboard": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { + "index-pattern": { + "dynamic": "strict", "properties": { - "searchSourceJSON": { + "fieldFormatMap": { + "type": "text" + }, + "fields": { + "type": "text" + }, + "intervalName": { + "type": "keyword" + }, + "notExpandable": { + "type": "boolean" + }, + "sourceFilters": { + "type": "text" + }, + "timeFieldName": { + "type": "keyword" + }, + "title": { "type": "text" } } }, - "optionsJSON": { - "type": "text" - }, - "panelsJSON": { - "type": "text" + "config": { + "dynamic": "true", + "properties": { + "buildNum": { + "type": "keyword" + } + } }, - "refreshInterval": { + "dashboard": { + "dynamic": "strict", "properties": { - "display": { + "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" }, - "pause": { + "timeRestore": { "type": "boolean" }, - "section": { - "type": "integer" + "timeTo": { + "type": "keyword" }, - "value": { + "title": { + "type": "text" + }, + "uiStateJSON": { + "type": "text" + }, + "version": { "type": "integer" } } }, - "timeFrom": { - "type": "keyword" - }, - "timeRestore": { - "type": "boolean" - }, - "timeTo": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "timelion-sheet": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { + "timelion-sheet": { + "dynamic": "strict", "properties": { - "searchSourceJSON": { + "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" } } - }, - "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" } } } diff --git a/test/functional/fixtures/es_archiver/visualize_source-filters/data.json.gz b/test/functional/fixtures/es_archiver/visualize_source-filters/data.json.gz index ec79629572ea5..084cccf7330ae 100644 Binary files a/test/functional/fixtures/es_archiver/visualize_source-filters/data.json.gz and b/test/functional/fixtures/es_archiver/visualize_source-filters/data.json.gz differ diff --git a/test/functional/fixtures/es_archiver/visualize_source-filters/mappings.json b/test/functional/fixtures/es_archiver/visualize_source-filters/mappings.json index e8cbf9d2a3771..cd9f29b7d8e3d 100644 --- a/test/functional/fixtures/es_archiver/visualize_source-filters/mappings.json +++ b/test/functional/fixtures/es_archiver/visualize_source-filters/mappings.json @@ -4,240 +4,239 @@ "index": ".kibana", "settings": { "index": { - "mapping": { - "single_type": "false" - }, "number_of_shards": "1", - "mapper": { - "dynamic": "false" - }, + "mapper.dynamic": false, "number_of_replicas": "1" } }, "mappings": { - "visualization": { - "dynamic": "strict", + "doc": { "properties": { - "description": { - "type": "text" + "type": { + "type": "keyword" }, - "kibanaSavedObjectMeta": { + "visualization": { + "dynamic": "strict", "properties": { - "searchSourceJSON": { + "description": { + "type": "text" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" + } + } + }, + "savedSearchId": { + "type": "keyword" + }, + "title": { + "type": "text" + }, + "uiStateJSON": { + "type": "text" + }, + "version": { + "type": "integer" + }, + "visState": { "type": "text" } } }, - "savedSearchId": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - }, - "visState": { - "type": "text" - } - } - }, - "timelion-sheet": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { + "timelion-sheet": { + "dynamic": "strict", "properties": { - "searchSourceJSON": { + "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" } } }, - "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" - } - } - }, - "config": { - "dynamic": "true", - "properties": { - "buildNum": { - "type": "keyword" - } - } - }, - "dashboard": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { + "config": { + "dynamic": "true", "properties": { - "searchSourceJSON": { - "type": "text" + "buildNum": { + "type": "keyword" } } }, - "optionsJSON": { - "type": "text" - }, - "panelsJSON": { - "type": "text" - }, - "refreshInterval": { + "dashboard": { + "dynamic": "strict", "properties": { - "display": { + "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" }, - "pause": { + "timeRestore": { "type": "boolean" }, - "section": { - "type": "integer" + "timeTo": { + "type": "keyword" }, - "value": { + "title": { + "type": "text" + }, + "uiStateJSON": { + "type": "text" + }, + "version": { "type": "integer" } } }, - "timeFrom": { - "type": "keyword" - }, - "timeRestore": { - "type": "boolean" - }, - "timeTo": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "index-pattern": { - "dynamic": "strict", - "properties": { - "fieldFormatMap": { - "type": "text" - }, - "fields": { - "type": "text" - }, - "intervalName": { - "type": "keyword" - }, - "notExpandable": { - "type": "boolean" - }, - "sourceFilters": { - "type": "text" - }, - "timeFieldName": { - "type": "keyword" - }, - "title": { - "type": "text" - } - } - }, - "_default_": { - "dynamic": "strict" - }, - "server": { - "dynamic": "strict", - "properties": { - "uuid": { - "type": "keyword" - } - } - }, - "search": { - "dynamic": "strict", - "properties": { - "columns": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { + "index-pattern": { + "dynamic": "strict", "properties": { - "searchSourceJSON": { + "fieldFormatMap": { + "type": "text" + }, + "fields": { + "type": "text" + }, + "intervalName": { + "type": "keyword" + }, + "notExpandable": { + "type": "boolean" + }, + "sourceFilters": { + "type": "text" + }, + "timeFieldName": { + "type": "keyword" + }, + "title": { "type": "text" } } }, - "sort": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "url": { - "dynamic": "strict", - "properties": { - "accessCount": { - "type": "long" - }, - "accessDate": { - "type": "date" + "server": { + "dynamic": "strict", + "properties": { + "uuid": { + "type": "keyword" + } + } }, - "createDate": { - "type": "date" + "search": { + "dynamic": "strict", + "properties": { + "columns": { + "type": "keyword" + }, + "description": { + "type": "text" + }, + "hits": { + "type": "integer" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" + } + } + }, + "sort": { + "type": "keyword" + }, + "title": { + "type": "text" + }, + "version": { + "type": "integer" + } + } }, "url": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 2048 + "dynamic": "strict", + "properties": { + "accessCount": { + "type": "long" + }, + "accessDate": { + "type": "date" + }, + "createDate": { + "type": "date" + }, + "url": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 2048 + } + } } } } diff --git a/test/functional/fixtures/es_archiver/visualize_source_filters/data.json.gz b/test/functional/fixtures/es_archiver/visualize_source_filters/data.json.gz index 62f6303cc780f..925e8b15d89d0 100644 Binary files a/test/functional/fixtures/es_archiver/visualize_source_filters/data.json.gz and b/test/functional/fixtures/es_archiver/visualize_source_filters/data.json.gz differ diff --git a/test/functional/fixtures/es_archiver/visualize_source_filters/mappings.json b/test/functional/fixtures/es_archiver/visualize_source_filters/mappings.json index ce9378ac3c808..f57afd6f8a089 100644 --- a/test/functional/fixtures/es_archiver/visualize_source_filters/mappings.json +++ b/test/functional/fixtures/es_archiver/visualize_source_filters/mappings.json @@ -4,260 +4,259 @@ "index": ".kibana", "settings": { "index": { - "mapping": { - "single_type": "false" - }, "number_of_shards": "1", - "mapper": { - "dynamic": "false" - }, + "mapper.dynamic": false, "number_of_replicas": "1" } }, "mappings": { - "index-pattern": { - "dynamic": "strict", + "doc": { "properties": { - "fieldFormatMap": { - "type": "text" - }, - "fields": { - "type": "text" - }, - "intervalName": { - "type": "keyword" - }, - "notExpandable": { - "type": "boolean" - }, - "sourceFilters": { - "type": "text" - }, - "timeFieldName": { + "type": { "type": "keyword" }, - "title": { - "type": "text" - } - } - }, - "server": { - "dynamic": "strict", - "properties": { - "uuid": { - "type": "keyword" - } - } - }, - "dashboard": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { + "index-pattern": { + "dynamic": "strict", "properties": { - "searchSourceJSON": { + "fieldFormatMap": { + "type": "text" + }, + "fields": { + "type": "text" + }, + "intervalName": { + "type": "keyword" + }, + "notExpandable": { + "type": "boolean" + }, + "sourceFilters": { + "type": "text" + }, + "timeFieldName": { + "type": "keyword" + }, + "title": { "type": "text" } } }, - "optionsJSON": { - "type": "text" - }, - "panelsJSON": { - "type": "text" + "server": { + "dynamic": "strict", + "properties": { + "uuid": { + "type": "keyword" + } + } }, - "refreshInterval": { + "dashboard": { + "dynamic": "strict", "properties": { - "display": { + "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" }, - "pause": { + "timeRestore": { "type": "boolean" }, - "section": { - "type": "integer" + "timeTo": { + "type": "keyword" + }, + "title": { + "type": "text" + }, + "uiStateJSON": { + "type": "text" }, - "value": { + "version": { "type": "integer" } } }, - "timeFrom": { - "type": "keyword" - }, - "timeRestore": { - "type": "boolean" - }, - "timeTo": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "search": { - "dynamic": "strict", - "properties": { - "columns": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { + "search": { + "dynamic": "strict", "properties": { - "searchSourceJSON": { + "columns": { + "type": "keyword" + }, + "description": { + "type": "text" + }, + "hits": { + "type": "integer" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" + } + } + }, + "sort": { + "type": "keyword" + }, + "title": { "type": "text" + }, + "version": { + "type": "integer" } } }, - "sort": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "_default_": { - "dynamic": "strict" - }, - "url": { - "dynamic": "strict", - "properties": { - "accessCount": { - "type": "long" - }, - "accessDate": { - "type": "date" - }, - "createDate": { - "type": "date" - }, "url": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 2048 - } - } - } - } - }, - "config": { - "dynamic": "true", - "properties": { - "buildNum": { - "type": "keyword" - }, - "dateFormat:tz": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + "dynamic": "strict", + "properties": { + "accessCount": { + "type": "long" + }, + "accessDate": { + "type": "date" + }, + "createDate": { + "type": "date" + }, + "url": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 2048 + } + } } } }, - "defaultIndex": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + "config": { + "dynamic": "true", + "properties": { + "buildNum": { + "type": "keyword" + }, + "dateFormat:tz": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "defaultIndex": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } } } - } - } - }, - "visualization": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" }, - "kibanaSavedObjectMeta": { + "visualization": { + "dynamic": "strict", "properties": { - "searchSourceJSON": { + "description": { + "type": "text" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" + } + } + }, + "savedSearchId": { + "type": "keyword" + }, + "title": { + "type": "text" + }, + "uiStateJSON": { + "type": "text" + }, + "version": { + "type": "integer" + }, + "visState": { "type": "text" } } }, - "savedSearchId": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - }, - "visState": { - "type": "text" - } - } - }, - "timelion-sheet": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { + "timelion-sheet": { + "dynamic": "strict", "properties": { - "searchSourceJSON": { + "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" } } - }, - "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" } } }