From 929aa8efae20a19e38dee8462cee6682035db7cb 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 --- .../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 | 205 +++++++++------ .../es_archiver/discover/mappings.json | 244 +++++++++++++---- .../es_archiver/empty_kibana/mappings.json | 224 ++++++++++++++++ .../es_archiver/visualize/mappings.json | 247 ++++++++++++++---- .../visualize_source-filters/mappings.json | 231 ++++++++++++++-- .../visualize_source_filters/mappings.json | 231 ++++++++++++++-- 11 files changed, 1477 insertions(+), 232 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 5dce4d82ae3b0..69cda79b02fa4 100644 --- a/src/core_plugins/elasticsearch/lib/__tests__/health_check.js +++ b/src/core_plugins/elasticsearch/lib/__tests__/health_check.js @@ -11,6 +11,7 @@ import kibanaVersion from '../kibana_version'; import { esTestServerUrlParts } from '../../../../../test/es_test_server_url_parts'; import * as determineEnabledScriptingLangsNS from '../determine_enabled_scripting_langs'; import { determineEnabledScriptingLangs } from '../determine_enabled_scripting_langs'; +import * as ensureTypesExistNS from '../ensure_types_exist'; const esPort = esTestServerUrlParts.port; const esUrl = url.format(esTestServerUrlParts); @@ -29,6 +30,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 = { @@ -85,6 +87,7 @@ describe('plugins/elasticsearch', () => { afterEach(() => { kibanaVersion.get.restore(); determineEnabledScriptingLangs.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 31e3d336e9847..ddc5f6cfac033 100644 --- a/src/core_plugins/elasticsearch/lib/health_check.js +++ b/src/core_plugins/elasticsearch/lib/health_check.js @@ -8,6 +8,7 @@ import { ensureEsVersion } from './ensure_es_version'; import { ensureNotTribe } from './ensure_not_tribe'; import { ensureAllowExplicitIndex } from './ensure_allow_explicit_index'; import { determineEnabledScriptingLangs } from './determine_enabled_scripting_langs'; +import { ensureTypesExist } from './ensure_types_exist'; const NoConnections = elasticsearch.errors.NoConnections; import util from 'util'; @@ -101,6 +102,12 @@ module.exports = 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(async () => { results.enabledScriptingLangs = await determineEnabledScriptingLangs(callDataAsKibanaUser); 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 49fcc7f8fa5d1..bf33b72f59d3f 100644 --- a/test/functional/fixtures/es_archiver/dashboard/mappings.json +++ b/test/functional/fixtures/es_archiver/dashboard/mappings.json @@ -4,79 +4,84 @@ "index": ".kibana", "settings": { "index": { - "number_of_shards": "5", + "number_of_shards": "1", + "mapper": { + "dynamic": "false" + }, "number_of_replicas": "1" } }, "mappings": { - "config": { + "index-pattern": { + "dynamic": "strict", "properties": { - "buildNum": { + "fieldFormatMap": { + "type": "text" + }, + "fields": { + "type": "text" + }, + "intervalName": { + "type": "keyword" + }, + "notExpandable": { + "type": "boolean" + }, + "sourceFilters": { + "type": "text" + }, + "timeFieldName": { "type": "keyword" + }, + "title": { + "type": "text" } } }, "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", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } + "type": "text" }, "version": { "type": "integer" }, "visState": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } + "type": "text" } } }, - "search": { + "_default_": { + "dynamic": "strict" + }, + "server": { + "dynamic": "strict", + "properties": { + "uuid": { + "type": "keyword" + } + } + }, + "timelion-sheet": { + "dynamic": "strict", "properties": { - "columns": { - "type": "text" - }, "description": { "type": "text" }, @@ -90,7 +95,22 @@ } } }, - "sort": { + "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": { @@ -101,54 +121,46 @@ } } }, - "index-pattern": { + "search": { + "dynamic": "strict", "properties": { - "fields": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } + "columns": { + "type": "keyword" }, - "sourceFilters": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } + "description": { + "type": "text" }, - "timeFieldName": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + "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" } } }, - "server": { + "config": { + "dynamic": "true", "properties": { - "uuid": { + "buildNum": { "type": "keyword" } } }, "dashboard": { + "dynamic": "strict", "properties": { "description": { "type": "text" @@ -169,14 +181,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" @@ -188,6 +216,29 @@ "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 + } + } + } + } } } } diff --git a/test/functional/fixtures/es_archiver/discover/mappings.json b/test/functional/fixtures/es_archiver/discover/mappings.json index b1d28b413a299..2f0b2249875d3 100644 --- a/test/functional/fixtures/es_archiver/discover/mappings.json +++ b/test/functional/fixtures/es_archiver/discover/mappings.json @@ -4,109 +4,241 @@ "index": ".kibana", "settings": { "index": { - "number_of_shards": "5", + "number_of_shards": "1", + "mapper": { + "dynamic": "false" + }, "number_of_replicas": "1" } }, "mappings": { "search": { + "dynamic": "strict", "properties": { "columns": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } + "type": "keyword" }, "description": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } + "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", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + "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": "long" + "type": "integer" + }, + "visState": { + "type": "text" } } }, - "index-pattern": { + "_default_": { + "dynamic": "strict" + }, + "config": { + "dynamic": "true", "properties": { - "fields": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + "buildNum": { + "type": "keyword" + } + } + }, + "timelion-sheet": { + "dynamic": "strict", + "properties": { + "description": { + "type": "text" + }, + "hits": { + "type": "integer" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" } } }, - "sourceFilters": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + "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" + } + } + }, + "dashboard": { + "dynamic": "strict", + "properties": { + "description": { + "type": "text" + }, + "hits": { + "type": "integer" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" } } }, - "timeFieldName": { - "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" + } + } + }, + "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 } } } } + }, + "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" + } + } } } } diff --git a/test/functional/fixtures/es_archiver/empty_kibana/mappings.json b/test/functional/fixtures/es_archiver/empty_kibana/mappings.json index 45867ce97458c..671e17be6e634 100644 --- a/test/functional/fixtures/es_archiver/empty_kibana/mappings.json +++ b/test/functional/fixtures/es_archiver/empty_kibana/mappings.json @@ -5,11 +5,23 @@ "settings": { "index": { "number_of_shards": "1", + "mapper": { + "dynamic": "false" + }, "number_of_replicas": "1" } }, "mappings": { + "server": { + "dynamic": "strict", + "properties": { + "uuid": { + "type": "keyword" + } + } + }, "config": { + "dynamic": "true", "properties": { "buildNum": { "type": "keyword" @@ -24,6 +36,218 @@ } } } + }, + "url": { + "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": { + "properties": { + "searchSourceJSON": { + "type": "text" + } + } + }, + "sort": { + "type": "keyword" + }, + "title": { + "type": "text" + }, + "version": { + "type": "integer" + } + } + }, + "_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" + } + } + }, + "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" + } + } + }, + "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" + } + } + }, + "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" + } + } } } } diff --git a/test/functional/fixtures/es_archiver/visualize/mappings.json b/test/functional/fixtures/es_archiver/visualize/mappings.json index 529183ce6b8ac..90e14273f56d8 100644 --- a/test/functional/fixtures/es_archiver/visualize/mappings.json +++ b/test/functional/fixtures/es_archiver/visualize/mappings.json @@ -4,102 +4,237 @@ "index": ".kibana", "settings": { "index": { - "number_of_shards": "5", + "number_of_shards": "1", + "mapper": { + "dynamic": "false" + }, "number_of_replicas": "1" } }, "mappings": { - "index-pattern": { + "dashboard": { + "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" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" } } }, - "timeFieldName": { - "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", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } + "type": "text" + }, + "uiStateJSON": { + "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" + } + } + }, + "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" } } }, - "uiStateJSON": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + "sort": { + "type": "keyword" + }, + "title": { + "type": "text" + }, + "version": { + "type": "integer" + } + } + }, + "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" + } + } + }, + "url": { + "dynamic": "strict", + "properties": { + "accessCount": { + "type": "long" }, - "visState": { + "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 1e13488403693..e8bd6440bc238 100644 --- a/test/functional/fixtures/es_archiver/visualize_source-filters/mappings.json +++ b/test/functional/fixtures/es_archiver/visualize_source-filters/mappings.json @@ -4,48 +4,239 @@ "index": ".kibana", "settings": { "index": { - "number_of_shards": "5", + "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": "keyword" + }, + "title": { + "type": "text" + } + } + }, + "config": { + "dynamic": "true", + "properties": { + "buildNum": { + "type": "keyword" + } + } + }, + "timelion-sheet": { + "dynamic": "strict", + "properties": { + "description": { + "type": "text" + }, + "hits": { + "type": "integer" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" } } }, - "timeFieldName": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + "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", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + "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" + } + } + }, + "_default_": { + "dynamic": "strict" + }, + "server": { + "dynamic": "strict", + "properties": { + "uuid": { + "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" } } } 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 02102b49e6339..5ec717ba81485 100644 --- a/test/functional/fixtures/es_archiver/visualize_source_filters/mappings.json +++ b/test/functional/fixtures/es_archiver/visualize_source_filters/mappings.json @@ -5,35 +5,106 @@ "settings": { "index": { "number_of_shards": "1", - "number_of_replicas": "0" + "mapper": { + "dynamic": "false" + }, + "number_of_replicas": "1" } }, "mappings": { - "config": { + "visualization": { + "dynamic": "strict", "properties": { - "dateFormat:tz": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + "description": { + "type": "text" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" } } }, - "defaultIndex": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + "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" } } }, "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" + } + } + }, + "config": { + "dynamic": "true", + "properties": { + "buildNum": { + "type": "keyword" + }, + "dateFormat:tz": { "type": "text", "fields": { "keyword": { @@ -42,7 +113,7 @@ } } }, - "sourceFilters": { + "defaultIndex": { "type": "text", "fields": { "keyword": { @@ -50,24 +121,140 @@ "ignore_above": 256 } } + } + } + }, + "server": { + "dynamic": "strict", + "properties": { + "uuid": { + "type": "keyword" + } + } + }, + "_default_": { + "dynamic": "strict" + }, + "dashboard": { + "dynamic": "strict", + "properties": { + "description": { + "type": "text" }, - "timeFieldName": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 + "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" + } + } + }, + "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 + } + } + } + } + }, + "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" } } }