From b3716d212516dacfad409fb0f8d3e4f0f829e1b4 Mon Sep 17 00:00:00 2001 From: Spencer Date: Wed, 12 Jul 2017 16:15:59 -0700 Subject: [PATCH] [elasticsearch] patch mappings that are missing types (#12783) * [elasticsearch] patch mappings that are missing types * [elasticsearch/healthCheck] fix tests * fix doc typo * [tests/functional/dashboard] fix suite name * [es/healthCheck/ensureTypesExist] limit randomness a bit * [test/functional] update es archives with complete mappings (cherry picked from commit 929aa8efae20a19e38dee8462cee6682035db7cb) --- .../lib/__tests__/ensure_types_exist.js | 247 +++++++++++++++++ .../lib/__tests__/health_check.js | 3 + .../elasticsearch/lib/ensure_types_exist.js | 68 +++++ .../elasticsearch/lib/health_check.js | 7 + .../apps/dashboard/_dashboard_clone.js | 2 +- .../es_archiver/dashboard/mappings.json | 231 ++++++++++------ .../es_archiver/discover/mappings.json | 244 +++++++++++++---- .../es_archiver/empty_kibana/mappings.json | 230 +++++++++++++++- .../es_archiver/visualize/mappings.json | 253 ++++++++++++++---- .../visualize_source-filters/mappings.json | 237 ++++++++++++++-- .../visualize_source_filters/mappings.json | 239 +++++++++++++++-- 11 files changed, 1512 insertions(+), 249 deletions(-) create mode 100644 src/core_plugins/elasticsearch/lib/__tests__/ensure_types_exist.js create mode 100644 src/core_plugins/elasticsearch/lib/ensure_types_exist.js diff --git a/src/core_plugins/elasticsearch/lib/__tests__/ensure_types_exist.js b/src/core_plugins/elasticsearch/lib/__tests__/ensure_types_exist.js new file mode 100644 index 0000000000000..8ee4993cb0e49 --- /dev/null +++ b/src/core_plugins/elasticsearch/lib/__tests__/ensure_types_exist.js @@ -0,0 +1,247 @@ +import expect from 'expect.js'; +import sinon from 'sinon'; +import { cloneDeep } from 'lodash'; +import Chance from 'chance'; + +import { ensureTypesExist } from '../ensure_types_exist'; + +const chance = new Chance(); + +function createRandomTypes(n = chance.integer({ min: 10, max: 20 })) { + return chance.n( + () => ({ + name: chance.word(), + mapping: { + type: chance.pickone(['keyword', 'text', 'integer', 'boolean']) + } + }), + n + ); +} + +function typesToMapping(types) { + return types.reduce((acc, type) => ({ + ...acc, + [type.name]: type.mapping + }), {}); +} + +function createV5Index(name, types) { + return { + [name]: { + mappings: typesToMapping(types) + } + }; +} + +function createV6Index(name, types) { + return { + [name]: { + mappings: { + doc: { + properties: typesToMapping(types) + } + } + } + }; +} + +function createCallCluster(index) { + return sinon.spy(async (method, params) => { + switch (method) { + case 'indices.get': + expect(params).to.have.property('index', Object.keys(index)[0]); + return cloneDeep(index); + case 'indices.putMapping': + return { ok: true }; + default: + throw new Error(`stub not expecting callCluster('${method}')`); + } + }); +} + +describe('es/healthCheck/ensureTypesExist()', () => { + describe('general', () => { + it('reads the _mappings feature of the indexName', async () => { + const indexName = chance.word(); + const callCluster = createCallCluster(createV5Index(indexName, [])); + await ensureTypesExist({ + callCluster, + indexName, + types: [], + log: sinon.stub() + }); + + sinon.assert.calledOnce(callCluster); + sinon.assert.calledWith(callCluster, 'indices.get', sinon.match({ + feature: '_mappings' + })); + }); + }); + + describe('v5 index', () => { + it('does nothing if mappings match elasticsearch', async () => { + const types = createRandomTypes(); + const indexName = chance.word(); + const callCluster = createCallCluster(createV5Index(indexName, types)); + await ensureTypesExist({ + indexName, + callCluster, + types, + log: sinon.stub() + }); + + sinon.assert.calledOnce(callCluster); + sinon.assert.calledWith(callCluster, 'indices.get', sinon.match({ index: indexName })); + }); + + it('adds types that are not in index', async () => { + const indexTypes = createRandomTypes(); + const missingTypes = indexTypes.splice(-5); + + const indexName = chance.word(); + const callCluster = createCallCluster(createV5Index(indexName, indexTypes)); + await ensureTypesExist({ + indexName, + callCluster, + types: [ + ...indexTypes, + ...missingTypes, + ], + log: sinon.stub() + }); + + sinon.assert.callCount(callCluster, 1 + missingTypes.length); + sinon.assert.calledWith(callCluster, 'indices.get', sinon.match({ index: indexName })); + missingTypes.forEach(type => { + sinon.assert.calledWith(callCluster, 'indices.putMapping', sinon.match({ + index: indexName, + type: type.name, + body: type.mapping + })); + }); + }); + + it('ignores extra types in index', async () => { + const indexTypes = createRandomTypes(); + const missingTypes = indexTypes.splice(-5); + + const indexName = chance.word(); + const callCluster = createCallCluster(createV5Index(indexName, indexTypes)); + await ensureTypesExist({ + indexName, + callCluster, + types: missingTypes, + log: sinon.stub() + }); + + sinon.assert.callCount(callCluster, 1 + missingTypes.length); + sinon.assert.calledWith(callCluster, 'indices.get', sinon.match({ index: indexName })); + missingTypes.forEach(type => { + sinon.assert.calledWith(callCluster, 'indices.putMapping', sinon.match({ + index: indexName, + type: type.name, + body: type.mapping + })); + }); + }); + }); + + describe('v6 index', () => { + it('does nothing if mappings match elasticsearch', async () => { + const types = createRandomTypes(); + const indexName = chance.word(); + const callCluster = createCallCluster(createV6Index(indexName, types)); + await ensureTypesExist({ + indexName, + callCluster, + types, + log: sinon.stub() + }); + + sinon.assert.calledOnce(callCluster); + sinon.assert.calledWith(callCluster, 'indices.get', sinon.match({ index: indexName })); + }); + + it('adds types that are not in index', async () => { + const indexTypes = createRandomTypes(); + const missingTypes = indexTypes.splice(-5); + + const indexName = chance.word(); + const callCluster = createCallCluster(createV6Index(indexName, indexTypes)); + await ensureTypesExist({ + indexName, + callCluster, + types: [ + ...indexTypes, + ...missingTypes, + ], + log: sinon.stub() + }); + + sinon.assert.callCount(callCluster, 1 + missingTypes.length); + sinon.assert.calledWith(callCluster, 'indices.get', sinon.match({ index: indexName })); + missingTypes.forEach(type => { + sinon.assert.calledWith(callCluster, 'indices.putMapping', sinon.match({ + index: indexName, + type: 'doc', + body: { + properties: { + [type.name]: type.mapping, + } + } + })); + }); + }); + + it('ignores extra types in index', async () => { + const indexTypes = createRandomTypes(); + const missingTypes = indexTypes.splice(-5); + + const indexName = chance.word(); + const callCluster = createCallCluster(createV6Index(indexName, indexTypes)); + await ensureTypesExist({ + indexName, + callCluster, + types: missingTypes, + log: sinon.stub() + }); + + sinon.assert.callCount(callCluster, 1 + missingTypes.length); + sinon.assert.calledWith(callCluster, 'indices.get', sinon.match({ index: indexName })); + missingTypes.forEach(type => { + sinon.assert.calledWith(callCluster, 'indices.putMapping', sinon.match({ + index: indexName, + type: 'doc', + body: { + properties: { + [type.name]: type.mapping, + } + } + })); + }); + }); + + it('does not define the _default_ type', async () => { + const indexTypes = []; + const missingTypes = [ + { + name: '_default_', + mapping: {} + } + ]; + + const indexName = chance.word(); + const callCluster = createCallCluster(createV6Index(indexName, indexTypes)); + await ensureTypesExist({ + indexName, + callCluster, + types: missingTypes, + log: sinon.stub() + }); + + sinon.assert.calledOnce(callCluster); + sinon.assert.calledWith(callCluster, 'indices.get', sinon.match({ index: indexName })); + }); + }); +}); diff --git a/src/core_plugins/elasticsearch/lib/__tests__/health_check.js b/src/core_plugins/elasticsearch/lib/__tests__/health_check.js index da6a6b6fcb428..74f6d6ae9051f 100644 --- a/src/core_plugins/elasticsearch/lib/__tests__/health_check.js +++ b/src/core_plugins/elasticsearch/lib/__tests__/health_check.js @@ -9,6 +9,7 @@ import mappings from './fixtures/mappings'; import healthCheck from '../health_check'; import kibanaVersion from '../kibana_version'; import { esTestServerUrlParts } from '../../../../../test/es_test_server_url_parts'; +import * as ensureTypesExistNS from '../ensure_types_exist'; const esPort = esTestServerUrlParts.port; const esUrl = url.format(esTestServerUrlParts); @@ -26,6 +27,7 @@ describe('plugins/elasticsearch', () => { // Stub the Kibana version instead of drawing from package.json. sinon.stub(kibanaVersion, 'get').returns(COMPATIBLE_VERSION_NUMBER); + sinon.stub(ensureTypesExistNS, 'ensureTypesExist'); // setup the plugin stub plugin = { @@ -78,6 +80,7 @@ describe('plugins/elasticsearch', () => { afterEach(() => { kibanaVersion.get.restore(); + ensureTypesExistNS.ensureTypesExist.restore(); }); it('should set the cluster green if everything is ready', function () { diff --git a/src/core_plugins/elasticsearch/lib/ensure_types_exist.js b/src/core_plugins/elasticsearch/lib/ensure_types_exist.js new file mode 100644 index 0000000000000..34a88f791334b --- /dev/null +++ b/src/core_plugins/elasticsearch/lib/ensure_types_exist.js @@ -0,0 +1,68 @@ +/** + * Checks that a kibana index has all of the types specified. Any type + * that is not defined in the existing index will be added via the + * `indicies.putMapping` API. + * + * @param {Object} options + * @property {Function} options.log a method for writing log messages + * @property {string} options.indexName name of the index in elasticsearch + * @property {Function} options.callCluster a function for executing client requests + * @property {Array} options.types an array of objects with `name` and `mapping` properties + * describing the types that should be in the index + * @return {Promise} + */ +export async function ensureTypesExist({ log, indexName, callCluster, types }) { + const index = await callCluster('indices.get', { + index: indexName, + feature: '_mappings' + }); + + // could be different if aliases were resolved by `indices.get` + const resolvedName = Object.keys(index)[0]; + const mappings = index[resolvedName].mappings; + const literalTypes = Object.keys(mappings); + const v6Index = literalTypes.length === 1 && literalTypes[0] === 'doc'; + + // our types aren't really es types, at least not in v6 + const typesDefined = Object.keys( + v6Index + ? mappings.doc.properties + : mappings + ); + + for (const type of types) { + if (v6Index && type.name === '_default_') { + // v6 indices don't get _default_ types + continue; + } + + const defined = typesDefined.includes(type.name); + if (defined) { + continue; + } + + log(['info', 'elasticsearch'], { + tmpl: `Adding mappings to kibana index for SavedObject type "<%= typeName %>"`, + typeName: type.name, + typeMapping: type.mapping + }); + + if (v6Index) { + await callCluster('indices.putMapping', { + index: indexName, + type: 'doc', + body: { + properties: { + [type.name]: type.mapping + } + } + }); + } else { + await callCluster('indices.putMapping', { + index: indexName, + type: type.name, + body: type.mapping + }); + } + } +} diff --git a/src/core_plugins/elasticsearch/lib/health_check.js b/src/core_plugins/elasticsearch/lib/health_check.js index 86bb43b1e3ec8..18fcda67100ae 100644 --- a/src/core_plugins/elasticsearch/lib/health_check.js +++ b/src/core_plugins/elasticsearch/lib/health_check.js @@ -7,6 +7,7 @@ import kibanaVersion from './kibana_version'; import { ensureEsVersion } from './ensure_es_version'; import { ensureNotTribe } from './ensure_not_tribe'; import { ensureAllowExplicitIndex } from './ensure_allow_explicit_index'; +import { ensureTypesExist } from './ensure_types_exist'; const NoConnections = elasticsearch.errors.NoConnections; import util from 'util'; @@ -98,6 +99,12 @@ export default function (plugin, server, { mappings }) { .then(() => ensureNotTribe(callAdminAsKibanaUser)) .then(() => ensureAllowExplicitIndex(callAdminAsKibanaUser, config)) .then(waitForShards) + .then(() => ensureTypesExist({ + callCluster: callAdminAsKibanaUser, + log: (...args) => server.log(...args), + indexName: config.get('kibana.index'), + types: Object.keys(mappings).map(name => ({ name, mapping: mappings[name] })) + })) .then(_.partial(migrateConfig, server, { mappings })) .then(() => { const tribeUrl = config.get('elasticsearch.tribe.url'); diff --git a/test/functional/apps/dashboard/_dashboard_clone.js b/test/functional/apps/dashboard/_dashboard_clone.js index b5f64e02f57d2..3f51f01019f52 100644 --- a/test/functional/apps/dashboard/_dashboard_clone.js +++ b/test/functional/apps/dashboard/_dashboard_clone.js @@ -4,7 +4,7 @@ export default function ({ getService, getPageObjects }) { const retry = getService('retry'); const PageObjects = getPageObjects(['dashboard', 'header', 'common']); - describe('dashboard save', function describeIndexTests() { + describe('dashboard clone', function describeIndexTests() { const dashboardName = 'Dashboard Clone Test'; const clonedDashboardName = dashboardName + ' Copy'; diff --git a/test/functional/fixtures/es_archiver/dashboard/mappings.json b/test/functional/fixtures/es_archiver/dashboard/mappings.json index 35a1f4a074b91..7a58ea71d5165 100644 --- a/test/functional/fixtures/es_archiver/dashboard/mappings.json +++ b/test/functional/fixtures/es_archiver/dashboard/mappings.json @@ -4,72 +4,48 @@ "index": ".kibana", "settings": { "index": { - "number_of_shards": "5", - "number_of_replicas": "1", - "mapping.single_type": false + "mapping": { + "single_type": "false" + }, + "number_of_shards": "1", + "mapper": { + "dynamic": "false" + }, + "number_of_replicas": "1" } }, "mappings": { - "visualization": { + "index-pattern": { + "dynamic": "strict", "properties": { - "description": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } + "fieldFormatMap": { + "type": "text" }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } + "fields": { + "type": "text" }, - "title": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } + "intervalName": { + "type": "keyword" }, - "uiStateJSON": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } + "notExpandable": { + "type": "boolean" }, - "version": { - "type": "integer" + "sourceFilters": { + "type": "text" }, - "visState": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } + "timeFieldName": { + "type": "keyword" + }, + "title": { + "type": "text" } } }, "search": { + "dynamic": "strict", "properties": { "columns": { - "type": "text" + "type": "keyword" }, "description": { "type": "text" @@ -85,7 +61,7 @@ } }, "sort": { - "type": "text" + "type": "keyword" }, "title": { "type": "text" @@ -95,47 +71,66 @@ } } }, - "index-pattern": { + "timelion-sheet": { + "dynamic": "strict", "properties": { - "fields": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } + "description": { + "type": "text" }, - "sourceFilters": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } + "hits": { + "type": "integer" }, - "timeFieldName": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + "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", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } + "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" @@ -156,14 +151,30 @@ "panelsJSON": { "type": "text" }, + "refreshInterval": { + "properties": { + "display": { + "type": "keyword" + }, + "pause": { + "type": "boolean" + }, + "section": { + "type": "integer" + }, + "value": { + "type": "integer" + } + } + }, "timeFrom": { - "type": "text" + "type": "keyword" }, "timeRestore": { "type": "boolean" }, "timeTo": { - "type": "text" + "type": "keyword" }, "title": { "type": "text" @@ -176,19 +187,61 @@ } } }, - "server": { + "visualization": { + "dynamic": "strict", "properties": { - "uuid": { + "description": { + "type": "text" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" + } + } + }, + "savedSearchId": { "type": "keyword" + }, + "title": { + "type": "text" + }, + "uiStateJSON": { + "type": "text" + }, + "version": { + "type": "integer" + }, + "visState": { + "type": "text" } } }, - "config": { + "url": { + "dynamic": "strict", "properties": { - "buildNum": { - "type": "keyword" + "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/mappings.json b/test/functional/fixtures/es_archiver/discover/mappings.json index 13199962379e8..2710bf90b8d57 100644 --- a/test/functional/fixtures/es_archiver/discover/mappings.json +++ b/test/functional/fixtures/es_archiver/discover/mappings.json @@ -4,102 +4,242 @@ "index": ".kibana", "settings": { "index": { - "number_of_shards": "5", - "number_of_replicas": "1", - "mapping.single_type": false + "mapping": { + "single_type": "false" + }, + "number_of_shards": "1", + "mapper": { + "dynamic": "false" + }, + "number_of_replicas": "1" } }, "mappings": { - "index-pattern": { + "url": { + "dynamic": "strict", "properties": { - "fields": { + "accessCount": { + "type": "long" + }, + "accessDate": { + "type": "date" + }, + "createDate": { + "type": "date" + }, + "url": { "type": "text", "fields": { "keyword": { "type": "keyword", - "ignore_above": 256 + "ignore_above": 2048 } } + } + } + }, + "index-pattern": { + "dynamic": "strict", + "properties": { + "fieldFormatMap": { + "type": "text" + }, + "fields": { + "type": "text" + }, + "intervalName": { + "type": "keyword" + }, + "notExpandable": { + "type": "boolean" }, "sourceFilters": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } + "type": "text" }, "timeFieldName": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + "type": "keyword" + }, + "title": { + "type": "text" + } + } + }, + "server": { + "dynamic": "strict", + "properties": { + "uuid": { + "type": "keyword" + } + } + }, + "dashboard": { + "dynamic": "strict", + "properties": { + "description": { + "type": "text" + }, + "hits": { + "type": "integer" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" } } }, - "title": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + "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" } } }, - "search": { + "config": { + "dynamic": "true", "properties": { - "columns": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + "buildNum": { + "type": "keyword" + } + } + }, + "visualization": { + "dynamic": "strict", + "properties": { + "description": { + "type": "text" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "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", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + "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" + } + } + }, + "search": { + "dynamic": "strict", + "properties": { + "columns": { + "type": "keyword" + }, + "description": { + "type": "text" + }, "hits": { - "type": "long" + "type": "integer" }, "kibanaSavedObjectMeta": { "properties": { "searchSourceJSON": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } + "type": "text" } } }, "sort": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } + "type": "keyword" }, "title": { "type": "text" }, "version": { - "type": "long" + "type": "integer" } } } diff --git a/test/functional/fixtures/es_archiver/empty_kibana/mappings.json b/test/functional/fixtures/es_archiver/empty_kibana/mappings.json index 9a0d2bd35fb9d..4279c41b5a5cf 100644 --- a/test/functional/fixtures/es_archiver/empty_kibana/mappings.json +++ b/test/functional/fixtures/es_archiver/empty_kibana/mappings.json @@ -4,13 +4,239 @@ "index": ".kibana", "settings": { "index": { + "mapping": { + "single_type": "false" + }, "number_of_shards": "1", - "number_of_replicas": "1", - "mapping.single_type": false + "mapper": { + "dynamic": "false" + }, + "number_of_replicas": "1" } }, "mappings": { + "timelion-sheet": { + "dynamic": "strict", + "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" + } + } + }, + "visualization": { + "dynamic": "strict", + "properties": { + "description": { + "type": "text" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "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": { + "properties": { + "searchSourceJSON": { + "type": "text" + } + } + }, + "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 + } + } + } + } + }, + "_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": { + "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" + } + } + }, + "server": { + "dynamic": "strict", + "properties": { + "uuid": { + "type": "keyword" + } + } + }, "config": { + "dynamic": "true", "properties": { "buildNum": { "type": "keyword" diff --git a/test/functional/fixtures/es_archiver/visualize/mappings.json b/test/functional/fixtures/es_archiver/visualize/mappings.json index 746fa60ff04e7..1d12de0d45aaa 100644 --- a/test/functional/fixtures/es_archiver/visualize/mappings.json +++ b/test/functional/fixtures/es_archiver/visualize/mappings.json @@ -4,105 +4,242 @@ "index": ".kibana", "settings": { "index": { - "number_of_shards": "5", - "number_of_replicas": "1", - "mapping.single_type": false + "mapping": { + "single_type": "false" + }, + "number_of_shards": "1", + "mapper": { + "dynamic": "false" + }, + "number_of_replicas": "1" } }, "mappings": { - "index-pattern": { + "server": { + "dynamic": "strict", "properties": { - "fields": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } + "uuid": { + "type": "keyword" + } + } + }, + "url": { + "dynamic": "strict", + "properties": { + "accessCount": { + "type": "long" }, - "sourceFilters": { + "accessDate": { + "type": "date" + }, + "createDate": { + "type": "date" + }, + "url": { "type": "text", "fields": { "keyword": { "type": "keyword", - "ignore_above": 256 + "ignore_above": 2048 } } + } + } + }, + "search": { + "dynamic": "strict", + "properties": { + "columns": { + "type": "keyword" }, - "timeFieldName": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + "description": { + "type": "text" + }, + "hits": { + "type": "integer" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" } } }, + "sort": { + "type": "keyword" + }, "title": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } + "type": "text" + }, + "version": { + "type": "integer" } } }, "visualization": { + "dynamic": "strict", "properties": { "description": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } + "type": "text" }, "kibanaSavedObjectMeta": { "properties": { "searchSourceJSON": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } + "type": "text" } } }, + "savedSearchId": { + "type": "keyword" + }, "title": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + "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": { + "properties": { + "searchSourceJSON": { + "type": "text" } } }, - "uiStateJSON": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + "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" + } + } + }, + "timelion-sheet": { + "dynamic": "strict", + "properties": { + "description": { + "type": "text" }, - "visState": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + "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" } } } 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 6e22ac8cce9a9..e8cbf9d2a3771 100644 --- a/test/functional/fixtures/es_archiver/visualize_source-filters/mappings.json +++ b/test/functional/fixtures/es_archiver/visualize_source-filters/mappings.json @@ -4,47 +4,240 @@ "index": ".kibana", "settings": { "index": { - "number_of_shards": "5", - "number_of_replicas": "1", - "mapping.single_type": false + "mapping": { + "single_type": "false" + }, + "number_of_shards": "1", + "mapper": { + "dynamic": "false" + }, + "number_of_replicas": "1" } }, "mappings": { - "index-pattern": { + "visualization": { + "dynamic": "strict", "properties": { - "fields": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + "description": { + "type": "text" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" } } }, - "sourceFilters": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + "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": { + "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" + } + } + }, + "config": { + "dynamic": "true", + "properties": { + "buildNum": { + "type": "keyword" + } + } + }, + "dashboard": { + "dynamic": "strict", + "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": { + "dynamic": "strict", + "properties": { + "fieldFormatMap": { + "type": "text" + }, + "fields": { + "type": "text" + }, + "intervalName": { + "type": "keyword" + }, + "notExpandable": { + "type": "boolean" + }, + "sourceFilters": { + "type": "text" + }, "timeFieldName": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + "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": { + "properties": { + "searchSourceJSON": { + "type": "text" } } }, + "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": 256 + "ignore_above": 2048 } } } 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 d4536237f9494..ce9378ac3c808 100644 --- a/test/functional/fixtures/es_archiver/visualize_source_filters/mappings.json +++ b/test/functional/fixtures/es_archiver/visualize_source_filters/mappings.json @@ -4,46 +4,172 @@ "index": ".kibana", "settings": { "index": { + "mapping": { + "single_type": "false" + }, "number_of_shards": "1", - "number_of_replicas": "0", - "mapping.single_type": false + "mapper": { + "dynamic": "false" + }, + "number_of_replicas": "1" } }, "mappings": { - "config": { + "index-pattern": { + "dynamic": "strict", "properties": { - "dateFormat:tz": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + "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": { + "properties": { + "searchSourceJSON": { + "type": "text" } } }, - "defaultIndex": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + "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": { + "search": { + "dynamic": "strict", "properties": { - "fields": { + "columns": { + "type": "keyword" + }, + "description": { + "type": "text" + }, + "hits": { + "type": "integer" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" + } + } + }, + "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": 256 + "ignore_above": 2048 } } + } + } + }, + "config": { + "dynamic": "true", + "properties": { + "buildNum": { + "type": "keyword" }, - "sourceFilters": { + "dateFormat:tz": { "type": "text", "fields": { "keyword": { @@ -52,7 +178,7 @@ } } }, - "timeFieldName": { + "defaultIndex": { "type": "text", "fields": { "keyword": { @@ -60,15 +186,78 @@ "ignore_above": 256 } } + } + } + }, + "visualization": { + "dynamic": "strict", + "properties": { + "description": { + "type": "text" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" + } + } + }, + "savedSearchId": { + "type": "keyword" }, "title": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + "type": "text" + }, + "uiStateJSON": { + "type": "text" + }, + "version": { + "type": "integer" + }, + "visState": { + "type": "text" + } + } + }, + "timelion-sheet": { + "dynamic": "strict", + "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" } } }