Skip to content

Commit

Permalink
Add saved object index migrations (#20243)
Browse files Browse the repository at this point in the history
Migrations are the mechanism by which saved object indices are kept up to date with the Kibana codebase. Plugin authors can write their plugins to work with a certain set of mappings. Migrations ensure that the index actually conforms to those expectations.
  • Loading branch information
chrisdavies authored Sep 17, 2018
1 parent f5d44f6 commit c64624a
Show file tree
Hide file tree
Showing 83 changed files with 5,655 additions and 914 deletions.
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
"@types/angular": "^1.6.45",
"@types/babel-core": "^6.25.5",
"@types/bluebird": "^3.1.1",
"@types/boom": "^7.2.0",
"@types/chance": "^1.0.0",
"@types/classnames": "^2.2.3",
"@types/dedent": "^0.7.0",
Expand All @@ -238,11 +239,14 @@
"@types/react-dom": "^16.0.5",
"@types/react-redux": "^6.0.6",
"@types/react-virtualized": "^9.18.7",
"@types/redux": "^3.6.31",
"@types/redux-actions": "^2.2.1",
"@types/sinon": "^5.0.0",
"@types/semver": "^5.5.0",
"@types/sinon": "^5.0.1",
"@types/strip-ansi": "^3.0.0",
"@types/supertest": "^2.0.5",
"@types/type-detect": "^4.0.1",
"@types/uuid": "^3.4.4",
"angular-mocks": "1.4.7",
"babel-eslint": "8.1.2",
"babel-jest": "^23.4.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ Object {
],
"type": "log",
},
Object {
"@timestamp": "## @timestamp ##",
"message": "The elasticsearch plugin is disabled. Skipping migrations.",
"pid": "## PID ##",
"tags": Array [
"warning",
"migration",
],
"type": "log",
},
Object {
"@timestamp": "## @timestamp ##",
"message": "Server running at http://localhost:8274",
Expand Down
2 changes: 0 additions & 2 deletions src/core_plugins/elasticsearch/lib/__tests__/health_check.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const NoConnections = require('elasticsearch').errors.NoConnections;
import mappings from './fixtures/mappings';
import healthCheck from '../health_check';
import kibanaVersion from '../kibana_version';
import * as patchKibanaIndexNS from '../patch_kibana_index';

const esPort = 9220;
const esUrl = `http://elastic:changement@localhost:9220`;
Expand All @@ -49,7 +48,6 @@ describe('plugins/elasticsearch', () => {

// Stub the Kibana version instead of drawing from package.json.
sandbox.stub(kibanaVersion, 'get').returns(COMPATIBLE_VERSION_NUMBER);
sandbox.stub(patchKibanaIndexNS, 'patchKibanaIndex');

// setup the plugin stub
plugin = {
Expand Down
218 changes: 0 additions & 218 deletions src/core_plugins/elasticsearch/lib/__tests__/patch_kibana_index.js

This file was deleted.

9 changes: 1 addition & 8 deletions src/core_plugins/elasticsearch/lib/health_check.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import Promise from 'bluebird';
import elasticsearch from 'elasticsearch';
import kibanaVersion from './kibana_version';
import { ensureEsVersion } from './ensure_es_version';
import { patchKibanaIndex } from './patch_kibana_index';

const NoConnections = elasticsearch.errors.NoConnections;

Expand Down Expand Up @@ -63,13 +62,7 @@ export default function (plugin, server) {
function check() {
const healthCheck =
waitForPong(callAdminAsKibanaUser, config.get('elasticsearch.url'))
.then(waitForEsVersion)
.then(() => patchKibanaIndex({
callCluster: callAdminAsKibanaUser,
log: (...args) => server.log(...args),
indexName: config.get('kibana.index'),
kibanaIndexMappingsDsl: server.getKibanaIndexMappingsDsl()
}));
.then(waitForEsVersion);

return healthCheck
.then(setGreenStatus)
Expand Down
Loading

0 comments on commit c64624a

Please sign in to comment.