mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
parent
1e271893e2
commit
7731105624
5 changed files with 43 additions and 54 deletions
|
@ -29,14 +29,6 @@ Object {
|
|||
},
|
||||
],
|
||||
"indices": Array [
|
||||
Object {
|
||||
"details": "[[type: doc, field: spins], [type: doc, field: mlockall], [type: doc, field: node_master], [type: doc, field: primary]]",
|
||||
"index": ".monitoring-es-6-2018.11.07",
|
||||
"level": "warning",
|
||||
"message": "Coercion of boolean fields",
|
||||
"reindex": false,
|
||||
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_mappings_changes.html#_coercion_of_boolean_fields",
|
||||
},
|
||||
Object {
|
||||
"details": "[[type: tweet, field: liked]]",
|
||||
"index": "twitter",
|
||||
|
@ -45,30 +37,6 @@ Object {
|
|||
"reindex": false,
|
||||
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_mappings_changes.html#_coercion_of_boolean_fields",
|
||||
},
|
||||
Object {
|
||||
"details": "[[type: index-pattern, field: notExpandable], [type: config, field: xPackMonitoring:allowReport], [type: config, field: xPackMonitoring:showBanner], [type: dashboard, field: pause], [type: dashboard, field: timeRestore]]",
|
||||
"index": ".kibana",
|
||||
"level": "warning",
|
||||
"message": "Coercion of boolean fields",
|
||||
"reindex": false,
|
||||
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_mappings_changes.html#_coercion_of_boolean_fields",
|
||||
},
|
||||
Object {
|
||||
"details": "[[type: doc, field: notify], [type: doc, field: created], [type: doc, field: attach_payload], [type: doc, field: met]]",
|
||||
"index": ".watcher-history-6-2018.11.07",
|
||||
"level": "warning",
|
||||
"message": "Coercion of boolean fields",
|
||||
"reindex": false,
|
||||
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_mappings_changes.html#_coercion_of_boolean_fields",
|
||||
},
|
||||
Object {
|
||||
"details": "[[type: doc, field: snapshot]]",
|
||||
"index": ".monitoring-kibana-6-2018.11.07",
|
||||
"level": "warning",
|
||||
"message": "Coercion of boolean fields",
|
||||
"reindex": false,
|
||||
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_mappings_changes.html#_coercion_of_boolean_fields",
|
||||
},
|
||||
Object {
|
||||
"details": "[[type: tweet, field: liked]]",
|
||||
"index": "twitter2",
|
||||
|
|
|
@ -12,6 +12,7 @@ import {
|
|||
DeprecationAPIResponse,
|
||||
DeprecationInfo,
|
||||
} from 'src/legacy/core_plugins/elasticsearch';
|
||||
import { isSystemIndex } from './reindexing';
|
||||
|
||||
import { getDeprecatedApmIndices } from './apm';
|
||||
|
||||
|
@ -60,28 +61,33 @@ const getCombinedIndexInfos = (
|
|||
) => {
|
||||
const apmIndices = apmIndexDeprecations.reduce((acc, dep) => acc.add(dep.index), new Set());
|
||||
|
||||
return Object.keys(deprecations.index_settings)
|
||||
.reduce(
|
||||
(indexDeprecations, indexName) => {
|
||||
// prevent APM indices from showing up for general re-indexing
|
||||
if (apmIndices.has(indexName)) {
|
||||
return indexDeprecations;
|
||||
}
|
||||
return (
|
||||
Object.keys(deprecations.index_settings)
|
||||
.reduce(
|
||||
(indexDeprecations, indexName) => {
|
||||
// prevent APM indices from showing up for general re-indexing
|
||||
if (apmIndices.has(indexName)) {
|
||||
return indexDeprecations;
|
||||
}
|
||||
|
||||
return indexDeprecations.concat(
|
||||
deprecations.index_settings[indexName].map(
|
||||
d =>
|
||||
({
|
||||
...d,
|
||||
index: indexName,
|
||||
reindex: /Index created before/.test(d.message),
|
||||
} as EnrichedDeprecationInfo)
|
||||
)
|
||||
);
|
||||
},
|
||||
[] as EnrichedDeprecationInfo[]
|
||||
)
|
||||
.concat(apmIndexDeprecations);
|
||||
return indexDeprecations.concat(
|
||||
deprecations.index_settings[indexName].map(
|
||||
d =>
|
||||
({
|
||||
...d,
|
||||
index: indexName,
|
||||
reindex: /Index created before/.test(d.message),
|
||||
} as EnrichedDeprecationInfo)
|
||||
)
|
||||
);
|
||||
},
|
||||
[] as EnrichedDeprecationInfo[]
|
||||
)
|
||||
// Filter out warnings for system indices until we know more about what changes are required for the
|
||||
// next upgrade in a future minor version. Note, we're still including APM depercations below.
|
||||
.filter(deprecation => !isSystemIndex(deprecation.index!))
|
||||
.concat(apmIndexDeprecations)
|
||||
);
|
||||
};
|
||||
|
||||
const getClusterDeprecations = (deprecations: DeprecationAPIResponse, isCloudEnabled: boolean) => {
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export { reindexServiceFactory } from './reindex_service';
|
||||
export { reindexServiceFactory, isSystemIndex } from './reindex_service';
|
||||
export { ReindexWorker } from './worker';
|
||||
|
|
|
@ -223,6 +223,12 @@ describe('reindexService', () => {
|
|||
expect(actions.createReindexOp).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('fails if system index', async () => {
|
||||
actions.getFlatSettings.mockResolvedValueOnce({ settings: {}, mappings: {} });
|
||||
await expect(service.createReindexOperation('.myIndex')).rejects.toThrow();
|
||||
expect(actions.createReindexOp).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('deletes existing operation if it failed', async () => {
|
||||
callCluster.mockResolvedValueOnce(true); // indices.exist
|
||||
actions.findReindexOperations.mockResolvedValueOnce({
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
import Boom from 'boom';
|
||||
|
||||
import { CallCluster } from 'src/legacy/core_plugins/elasticsearch';
|
||||
import { CURRENT_MAJOR_VERSION } from 'x-pack/plugins/upgrade_assistant/common/version';
|
||||
import { XPackInfo } from 'x-pack/plugins/xpack_main/server/lib/xpack_info';
|
||||
import {
|
||||
IndexGroup,
|
||||
|
@ -527,6 +528,12 @@ export const reindexServiceFactory = (
|
|||
},
|
||||
|
||||
async createReindexOperation(indexName: string) {
|
||||
if (isSystemIndex(indexName)) {
|
||||
throw Boom.notImplemented(
|
||||
`Reindexing system indices are not yet supported within this major version. Upgrade to the latest ${CURRENT_MAJOR_VERSION}.x minor version.`
|
||||
);
|
||||
}
|
||||
|
||||
const indexExists = await callCluster('indices.exists', { index: indexName });
|
||||
if (!indexExists) {
|
||||
throw Boom.notFound(`Index ${indexName} does not exist in this cluster.`);
|
||||
|
@ -673,6 +680,8 @@ export const reindexServiceFactory = (
|
|||
};
|
||||
};
|
||||
|
||||
export const isSystemIndex = (indexName: string) => indexName.startsWith('.');
|
||||
|
||||
export const isMlIndex = (indexName: string) => {
|
||||
const sourceName = sourceNameForIndex(indexName);
|
||||
return ML_INDICES.indexOf(sourceName) >= 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue