Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Kibana to Elasticsearch 7.0 #29184

Merged
merged 42 commits into from
Jan 30, 2019
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
193b862
Make CI use the latest elasticsearch snapshot (#28854)
chrisdavies Jan 16, 2019
79c3207
Merge branch 'upgrade/elasticsearch-7-0' of github.com:elastic/kibana…
chrisdavies Jan 23, 2019
af73df6
Upgrade es archives to support ES7.0 (#29179)
chrisdavies Jan 23, 2019
0becc07
[Monitoring] Get monitoring tests working with mapping changes (#29188)
chrisronline Jan 23, 2019
c4aa278
Fix uiSettings tests (#29258)
chrisdavies Jan 24, 2019
93d5b81
Drop support for deleting the Kibana index (#29268)
chrisdavies Jan 24, 2019
090e057
Upgrade/es 7 tests (#29270)
chrisdavies Jan 24, 2019
b54d5ba
Upgrade es 7 tests (#29273)
chrisdavies Jan 24, 2019
a9f7732
Merge master (#29274)
chrisdavies Jan 24, 2019
e5f1bb7
Merge branch 'master' into upgrade/elasticsearch-7-0
chrisdavies Jan 24, 2019
38eabbe
Upgrade es 7 tests (#29276)
chrisdavies Jan 24, 2019
b9bd19d
Fix server mappings tests
chrisdavies Jan 24, 2019
6ca9897
Fix management functional tests
chrisdavies Jan 24, 2019
c43cd3f
Fix api_integration es archives
chrisdavies Jan 24, 2019
9ee8499
Fix management functional tests
chrisdavies Jan 24, 2019
54cf657
Remove x-pack monitoring archive mappings
chrisdavies Jan 24, 2019
0eabf84
Merge branch 'master' of github.com:elastic/kibana into upgrade/elast…
chrisdavies Jan 24, 2019
2306d54
Fixing security functional tests for ES 7 (#29229)
kobelb Jan 25, 2019
9d4748b
Merge branch 'upgrade/elasticsearch-7-0' of github.com:elastic/kibana…
chrisdavies Jan 25, 2019
3c3ac01
Temporary workaround for esjs and es 7 incompatibility
chrisdavies Jan 25, 2019
7560f70
Merge branch 'master' of github.com:elastic/kibana into upgrade/elast…
chrisdavies Jan 25, 2019
208d963
Fix logstash elasticsearch 7 tests
chrisdavies Jan 25, 2019
81ff188
Fix flakey alert test
chrisdavies Jan 25, 2019
bd75b5e
Fix BWC reporting tests
chrisdavies Jan 25, 2019
fb29c95
[6.x] Add new `allow_restricted_indices` field to the expected roles …
kobelb Jan 25, 2019
bfab7ee
Merge branch 'master' of github.com:elastic/kibana into upgrade/elast…
chrisdavies Jan 25, 2019
275a094
Merge branch 'upgrade/elasticsearch-7-0' of github.com:elastic/kibana…
chrisdavies Jan 25, 2019
afe8ba1
Fix monitoring mappings_exists tests
chrisdavies Jan 25, 2019
dd0029e
Fix es_archiver pre-7.0 logic
chrisdavies Jan 25, 2019
0dfd132
Fix bwc 6_3 mappings
chrisdavies Jan 25, 2019
535b98b
Fix es_archiver test to handle include_type_name
chrisdavies Jan 25, 2019
a1f9dd9
[Monitoring] Change null to 0s (#29380)
chrisronline Jan 25, 2019
9916c8a
Merge branch 'master' of github.com:elastic/kibana into upgrade/elast…
chrisdavies Jan 28, 2019
b0f0a7b
Merge branch 'master' of github.com:elastic/kibana into upgrade/elast…
chrisdavies Jan 28, 2019
c24e018
Fix logstash test
chrisdavies Jan 28, 2019
91f8f2d
Merge branch 'upgrade/elasticsearch-7-0' of github.com:elastic/kibana…
chrisdavies Jan 28, 2019
48cde09
Merge master
chrisdavies Jan 28, 2019
b92edcc
Fix telemetry tests
chrisdavies Jan 28, 2019
0818b1a
Fix telemetry tests, maybe?
chrisdavies Jan 28, 2019
9c87b47
Remove console.log comment
chrisdavies Jan 29, 2019
7ee8efb
Merge master
chrisdavies Jan 30, 2019
85d05d1
Remove superfluous (and misleading) comment
chrisdavies Jan 30, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/dev/ci_setup/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fi
export KIBANA_DIR="$dir"
export XPACK_DIR="$KIBANA_DIR/x-pack"
export PARENT_DIR="$(cd "$KIBANA_DIR/.."; pwd)"
export TEST_ES_SNAPSHOT_VERSION="7.0.0-fbd1a09d"

echo "-> KIBANA_DIR $KIBANA_DIR"
echo "-> XPACK_DIR $XPACK_DIR"
echo "-> PARENT_DIR $PARENT_DIR"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ describe('esArchiver: createCreateIndexStream()', () => {
sinon.assert.calledWith(client.indices.create, {
method: 'PUT',
index: 'index',
include_type_name: false,
body: {
settings: undefined,
mappings: undefined,
Expand Down
4 changes: 4 additions & 0 deletions src/es_archiver/lib/indices/create_index_stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ export function createCreateIndexStream({ client, stats, skipExisting, log, kiba
async function handleIndex(record) {
const { index, settings, mappings, aliases } = record.value;

// Determine if the mapping belongs to a pre-7.0 instance, for BWC tests, mainly
const isPre7Mapping = !!mappings && Object.keys(mappings).length > 0 && !mappings.properties;

async function attemptToCreate(attemptNumber = 1) {
try {
if (index.startsWith('.kibana')) {
Expand All @@ -53,6 +56,7 @@ export function createCreateIndexStream({ client, stats, skipExisting, log, kiba
await client.indices.create({
method: 'PUT',
index,
include_type_name: isPre7Mapping,
body: { settings, mappings, aliases },
});

Expand Down
2 changes: 1 addition & 1 deletion src/es_archiver/lib/indices/kibana_index.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ async function getKibanaStatuses({ kibanaUrl }) {
export async function createDefaultSpace({ index, client }) {
await client.index({
index,
type: 'doc',
type: '_doc',
id: 'space:default',
body: {
type: 'space',
Expand Down
1 change: 0 additions & 1 deletion src/server/mappings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

export {
getTypes,
getRootType,
getProperty,
getRootProperties,
getRootPropertiesObjects,
Expand Down
4 changes: 1 addition & 3 deletions src/server/mappings/lib/get_property.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

import toPath from 'lodash/internal/toPath';

import { getRootType } from './get_root_type';

/**
* Recursively read properties from the mapping object of type "object"
* until the `path` is resolved.
Expand Down Expand Up @@ -53,7 +51,7 @@ function getPropertyMappingFromObjectMapping(mapping, path) {
*/
export function getProperty(mappings, path) {
return getPropertyMappingFromObjectMapping(
mappings[getRootType(mappings)],
mappings,
toPath(path)
);
}
56 changes: 27 additions & 29 deletions src/server/mappings/lib/get_property.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,24 @@
import { getProperty } from './get_property';

const MAPPINGS = {
rootType: {
properties: {
foo: {
properties: {
name: {
type: 'text'
},
description: {
type: 'text'
}
properties: {
foo: {
properties: {
name: {
type: 'text'
},
description: {
type: 'text'
}
},
bar: {
properties: {
baz: {
type: 'text',
fields: {
box: {
type: 'keyword'
}
}
},
bar: {
properties: {
baz: {
type: 'text',
fields: {
box: {
type: 'keyword'
}
}
}
Expand All @@ -58,28 +56,28 @@ function runTest(key, mapping) {
describe('getProperty(mappings, path)', () => {
describe('string key', () => {
it('finds root properties', () => {
runTest('foo', MAPPINGS.rootType.properties.foo);
runTest('foo', MAPPINGS.properties.foo);
});
it('finds nested properties', () => {
runTest('foo.name', MAPPINGS.rootType.properties.foo.properties.name);
runTest('foo.description', MAPPINGS.rootType.properties.foo.properties.description);
runTest('bar.baz', MAPPINGS.rootType.properties.bar.properties.baz);
runTest('foo.name', MAPPINGS.properties.foo.properties.name);
runTest('foo.description', MAPPINGS.properties.foo.properties.description);
runTest('bar.baz', MAPPINGS.properties.bar.properties.baz);
});
it('finds nested multi-fields', () => {
runTest('bar.baz.box', MAPPINGS.rootType.properties.bar.properties.baz.fields.box);
runTest('bar.baz.box', MAPPINGS.properties.bar.properties.baz.fields.box);
});
});
describe('array of string keys', () => {
it('finds root properties', () => {
runTest(['foo'], MAPPINGS.rootType.properties.foo);
runTest(['foo'], MAPPINGS.properties.foo);
});
it('finds nested properties', () => {
runTest(['foo', 'name'], MAPPINGS.rootType.properties.foo.properties.name);
runTest(['foo', 'description'], MAPPINGS.rootType.properties.foo.properties.description);
runTest(['bar', 'baz'], MAPPINGS.rootType.properties.bar.properties.baz);
runTest(['foo', 'name'], MAPPINGS.properties.foo.properties.name);
runTest(['foo', 'description'], MAPPINGS.properties.foo.properties.description);
runTest(['bar', 'baz'], MAPPINGS.properties.bar.properties.baz);
});
it('finds nested multi-fields', () => {
runTest(['bar', 'baz', 'box'], MAPPINGS.rootType.properties.bar.properties.baz.fields.box);
runTest(['bar', 'baz', 'box'], MAPPINGS.properties.bar.properties.baz.fields.box);
});
});
});
8 changes: 2 additions & 6 deletions src/server/mappings/lib/get_root_properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
* under the License.
*/

import { getRootType } from './get_root_type';

/**
* Get the property mappings for the root type in the EsMappingsDsl
*
Expand All @@ -34,12 +32,10 @@ import { getRootType } from './get_root_type';
* This data can be found at `{indexName}.mappings.{typeName}.properties`
* in the es indices.get() response.
*
* @param {EsMappingsDsl} mappings
* @param {EsMappingsDsl} mapping
* @return {EsPropertyMappings}
*/
export function getRootProperties(mappings) {
const mapping = mappings[getRootType(mappings)];

export function getRootProperties(mapping) {
if (mapping.type !== 'object' && !mapping.properties) {
throw new TypeError('Unable to get property names non-object root mapping');
}
Expand Down
94 changes: 39 additions & 55 deletions src/server/mappings/lib/get_root_properties_objects.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ import { getRootPropertiesObjects } from './get_root_properties_objects';

test(`returns single object with properties`, () => {
const mappings = {
rootType: {
properties: {
foo: {
properties: {}
}
properties: {
foo: {
properties: {}
}
}
};
Expand All @@ -40,11 +38,9 @@ test(`returns single object with properties`, () => {

test(`returns single object with type === 'object'`, () => {
const mappings = {
rootType: {
properties: {
foo: {
type: 'object'
}
properties: {
foo: {
type: 'object'
}
}
};
Expand All @@ -59,14 +55,12 @@ test(`returns single object with type === 'object'`, () => {

test(`returns two objects with properties`, () => {
const mappings = {
rootType: {
properties: {
foo: {
properties: {}
},
bar: {
properties: {}
}
properties: {
foo: {
properties: {}
},
bar: {
properties: {}
}
}
};
Expand All @@ -84,14 +78,12 @@ test(`returns two objects with properties`, () => {

test(`returns two objects with type === 'object'`, () => {
const mappings = {
rootType: {
properties: {
foo: {
type: 'object'
},
bar: {
type: 'object'
}
properties: {
foo: {
type: 'object'
},
bar: {
type: 'object'
}
}
};
Expand All @@ -109,11 +101,9 @@ test(`returns two objects with type === 'object'`, () => {

test(`excludes objects without properties and type of keyword`, () => {
const mappings = {
rootType: {
properties: {
foo: {
type: 'keyword'
}
properties: {
foo: {
type: 'keyword'
}
}
};
Expand All @@ -124,14 +114,12 @@ test(`excludes objects without properties and type of keyword`, () => {

test(`excludes two objects without properties and type of keyword`, () => {
const mappings = {
rootType: {
properties: {
foo: {
type: 'keyword'
},
bar: {
type: 'keyword'
}
properties: {
foo: {
type: 'keyword'
},
bar: {
type: 'keyword'
}
}
};
Expand All @@ -142,14 +130,12 @@ test(`excludes two objects without properties and type of keyword`, () => {

test(`includes one object with properties and excludes one object without properties`, () => {
const mappings = {
rootType: {
properties: {
foo: {
properties: {}
},
bar: {
type: 'keyword'
}
properties: {
foo: {
properties: {}
},
bar: {
type: 'keyword'
}
}
};
Expand All @@ -164,14 +150,12 @@ test(`includes one object with properties and excludes one object without proper

test(`includes one object with type === 'object' and excludes one object without properties`, () => {
const mappings = {
rootType: {
properties: {
foo: {
type: 'object'
},
bar: {
type: 'keyword'
}
properties: {
foo: {
type: 'object'
},
bar: {
type: 'keyword'
}
}
};
Expand Down
38 changes: 0 additions & 38 deletions src/server/mappings/lib/get_root_type.js

This file was deleted.

1 change: 0 additions & 1 deletion src/server/mappings/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@

export { getProperty } from './get_property';
export { getTypes } from './get_types';
export { getRootType } from './get_root_type';
export { getRootProperties } from './get_root_properties';
export { getRootPropertiesObjects } from './get_root_properties_objects';
4 changes: 1 addition & 3 deletions src/server/sample_data/routes/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,7 @@ export const createInstallRoute = () => ({
}
},
mappings: {
_doc: {
properties: dataIndexConfig.fields
}
properties: dataIndexConfig.fields
}
}
};
Expand Down
Loading