From 03636a07fe23ef80b46d3f0a6958f7164abc4138 Mon Sep 17 00:00:00 2001
From: Rudolf Meijering string
| |
+
+Returns:
+
+`DecoratedError`
+
diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorateindexaliasnotfounderror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorateindexaliasnotfounderror.md
new file mode 100644
index 0000000000000..c7e10fc42ead1
--- /dev/null
+++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorateindexaliasnotfounderror.md
@@ -0,0 +1,23 @@
+
+
+[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SavedObjectsErrorHelpers](./kibana-plugin-core-server.savedobjectserrorhelpers.md) > [decorateIndexAliasNotFoundError](./kibana-plugin-core-server.savedobjectserrorhelpers.decorateindexaliasnotfounderror.md)
+
+## SavedObjectsErrorHelpers.decorateIndexAliasNotFoundError() method
+
+Signature:
+
+```typescript
+static decorateIndexAliasNotFoundError(error: Error, alias: string): DecoratedError;
+```
+
+## Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| error | Error
| |
+| alias | string
| |
+
+Returns:
+
+`DecoratedError`
+
diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isgeneralerror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isgeneralerror.md
new file mode 100644
index 0000000000000..4b4ede2f77a7e
--- /dev/null
+++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isgeneralerror.md
@@ -0,0 +1,22 @@
+
+
+[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SavedObjectsErrorHelpers](./kibana-plugin-core-server.savedobjectserrorhelpers.md) > [isGeneralError](./kibana-plugin-core-server.savedobjectserrorhelpers.isgeneralerror.md)
+
+## SavedObjectsErrorHelpers.isGeneralError() method
+
+Signature:
+
+```typescript
+static isGeneralError(error: Error | DecoratedError): boolean;
+```
+
+## Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| error | Error | DecoratedError
| |
+
+Returns:
+
+`boolean`
+
diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.md
index 9b69012ed5f12..2dc78f2df3a83 100644
--- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.md
+++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.md
@@ -18,6 +18,7 @@ export declare class SavedObjectsErrorHelpers
| [createBadRequestError(reason)](./kibana-plugin-core-server.savedobjectserrorhelpers.createbadrequesterror.md) | static
| |
| [createConflictError(type, id, reason)](./kibana-plugin-core-server.savedobjectserrorhelpers.createconflicterror.md) | static
| |
| [createGenericNotFoundError(type, id)](./kibana-plugin-core-server.savedobjectserrorhelpers.creategenericnotfounderror.md) | static
| |
+| [createIndexAliasNotFoundError(alias)](./kibana-plugin-core-server.savedobjectserrorhelpers.createindexaliasnotfounderror.md) | static
| |
| [createInvalidVersionError(versionInput)](./kibana-plugin-core-server.savedobjectserrorhelpers.createinvalidversionerror.md) | static
| |
| [createTooManyRequestsError(type, id)](./kibana-plugin-core-server.savedobjectserrorhelpers.createtoomanyrequestserror.md) | static
| |
| [createUnsupportedTypeError(type)](./kibana-plugin-core-server.savedobjectserrorhelpers.createunsupportedtypeerror.md) | static
| |
@@ -27,6 +28,7 @@ export declare class SavedObjectsErrorHelpers
| [decorateEsUnavailableError(error, reason)](./kibana-plugin-core-server.savedobjectserrorhelpers.decorateesunavailableerror.md) | static
| |
| [decorateForbiddenError(error, reason)](./kibana-plugin-core-server.savedobjectserrorhelpers.decorateforbiddenerror.md) | static
| |
| [decorateGeneralError(error, reason)](./kibana-plugin-core-server.savedobjectserrorhelpers.decorategeneralerror.md) | static
| |
+| [decorateIndexAliasNotFoundError(error, alias)](./kibana-plugin-core-server.savedobjectserrorhelpers.decorateindexaliasnotfounderror.md) | static
| |
| [decorateNotAuthorizedError(error, reason)](./kibana-plugin-core-server.savedobjectserrorhelpers.decoratenotauthorizederror.md) | static
| |
| [decorateRequestEntityTooLargeError(error, reason)](./kibana-plugin-core-server.savedobjectserrorhelpers.decoraterequestentitytoolargeerror.md) | static
| |
| [decorateTooManyRequestsError(error, reason)](./kibana-plugin-core-server.savedobjectserrorhelpers.decoratetoomanyrequestserror.md) | static
| |
@@ -35,6 +37,7 @@ export declare class SavedObjectsErrorHelpers
| [isEsCannotExecuteScriptError(error)](./kibana-plugin-core-server.savedobjectserrorhelpers.isescannotexecutescripterror.md) | static
| |
| [isEsUnavailableError(error)](./kibana-plugin-core-server.savedobjectserrorhelpers.isesunavailableerror.md) | static
| |
| [isForbiddenError(error)](./kibana-plugin-core-server.savedobjectserrorhelpers.isforbiddenerror.md) | static
| |
+| [isGeneralError(error)](./kibana-plugin-core-server.savedobjectserrorhelpers.isgeneralerror.md) | static
| |
| [isInvalidVersionError(error)](./kibana-plugin-core-server.savedobjectserrorhelpers.isinvalidversionerror.md) | static
| |
| [isNotAuthorizedError(error)](./kibana-plugin-core-server.savedobjectserrorhelpers.isnotauthorizederror.md) | static
| |
| [isNotFoundError(error)](./kibana-plugin-core-server.savedobjectserrorhelpers.isnotfounderror.md) | static
| |
diff --git a/packages/kbn-es-archiver/src/actions/empty_kibana_index.ts b/packages/kbn-es-archiver/src/actions/empty_kibana_index.ts
index 56c75c5aca419..6272d6ba00ee8 100644
--- a/packages/kbn-es-archiver/src/actions/empty_kibana_index.ts
+++ b/packages/kbn-es-archiver/src/actions/empty_kibana_index.ts
@@ -25,5 +25,6 @@ export async function emptyKibanaIndexAction({
await cleanKibanaIndices({ client, stats, log, kibanaPluginIds });
await migrateKibanaIndex({ client, kbnClient });
- return stats;
+ stats.createdIndex('.kibana');
+ return stats.toJSON();
}
diff --git a/packages/kbn-es-archiver/src/es_archiver.ts b/packages/kbn-es-archiver/src/es_archiver.ts
index f101c5d6867f1..8601dedad0e27 100644
--- a/packages/kbn-es-archiver/src/es_archiver.ts
+++ b/packages/kbn-es-archiver/src/es_archiver.ts
@@ -155,7 +155,7 @@ export class EsArchiver {
* @return Promise
*/
async emptyKibanaIndex() {
- await emptyKibanaIndexAction({
+ return await emptyKibanaIndexAction({
client: this.client,
log: this.log,
kbnClient: this.kbnClient,
diff --git a/packages/kbn-es-archiver/src/lib/indices/kibana_index.ts b/packages/kbn-es-archiver/src/lib/indices/kibana_index.ts
index 0459a4301cf6b..91c0bd8343a36 100644
--- a/packages/kbn-es-archiver/src/lib/indices/kibana_index.ts
+++ b/packages/kbn-es-archiver/src/lib/indices/kibana_index.ts
@@ -76,7 +76,9 @@ export async function migrateKibanaIndex({
*/
async function fetchKibanaIndices(client: Client) {
const kibanaIndices = await client.cat.indices({ index: '.kibana*', format: 'json' });
- const isKibanaIndex = (index: string) => /^\.kibana(:?_\d*)?$/.test(index);
+ const isKibanaIndex = (index: string) =>
+ /^\.kibana(:?_\d*)?$/.test(index) ||
+ /^\.kibana(_task_manager)?_(pre)?\d+\.\d+\.\d+/.test(index);
return kibanaIndices.map((x: { index: string }) => x.index).filter(isKibanaIndex);
}
@@ -103,7 +105,7 @@ export async function cleanKibanaIndices({
while (true) {
const resp = await client.deleteByQuery({
- index: `.kibana`,
+ index: `.kibana,.kibana_task_manager`,
body: {
query: {
bool: {
@@ -115,7 +117,7 @@ export async function cleanKibanaIndices({
},
},
},
- ignore: [409],
+ ignore: [404, 409],
});
if (resp.total !== resp.deleted) {
diff --git a/src/core/server/saved_objects/migrationsv2/model.test.ts b/src/core/server/saved_objects/migrationsv2/model.test.ts
index d5ab85c54a728..a9aa69960b1c2 100644
--- a/src/core/server/saved_objects/migrationsv2/model.test.ts
+++ b/src/core/server/saved_objects/migrationsv2/model.test.ts
@@ -182,6 +182,21 @@ describe('migrations v2 model', () => {
versionAlias: '.kibana_7.11.0',
versionIndex: '.kibana_7.11.0_001',
};
+ const mappingsWithUnknownType = {
+ properties: {
+ disabled_saved_object_type: {
+ properties: {
+ value: { type: 'keyword' },
+ },
+ },
+ },
+ _meta: {
+ migrationMappingPropertyHashes: {
+ disabled_saved_object_type: '7997cf5a56cc02bdc9c93361bde732b0',
+ },
+ },
+ };
+
test('INIT -> OUTDATED_DOCUMENTS_SEARCH if .kibana is already pointing to the target index', () => {
const res: ResponseType<'INIT'> = Either.right({
'.kibana_7.11.0_001': {
@@ -189,38 +204,27 @@ describe('migrations v2 model', () => {
'.kibana': {},
'.kibana_7.11.0': {},
},
- mappings: {
- properties: {
- disabled_saved_object_type: {
- properties: {
- value: { type: 'keyword' },
- },
- },
- },
- _meta: {
- migrationMappingPropertyHashes: {
- disabled_saved_object_type: '7997cf5a56cc02bdc9c93361bde732b0',
- },
- },
- },
+ mappings: mappingsWithUnknownType,
settings: {},
},
});
const newState = model(initState, res);
expect(newState.controlState).toEqual('OUTDATED_DOCUMENTS_SEARCH');
+ // This snapshot asserts that we merge the
+ // migrationMappingPropertyHashes of the existing index, but we leave
+ // the mappings for the disabled_saved_object_type untouched. There
+ // might be another Kibana instance that knows about this type and
+ // needs these mappings in place.
expect(newState.targetIndexMappings).toMatchInlineSnapshot(`
Object {
"_meta": Object {
"migrationMappingPropertyHashes": Object {
+ "disabled_saved_object_type": "7997cf5a56cc02bdc9c93361bde732b0",
"new_saved_object_type": "4a11183eee21e6fbad864f7a30b39ad0",
},
},
"properties": Object {
- "disabled_saved_object_type": Object {
- "dynamic": false,
- "properties": Object {},
- },
"new_saved_object_type": Object {
"properties": Object {
"value": Object {
@@ -271,7 +275,7 @@ describe('migrations v2 model', () => {
'.kibana': {},
'.kibana_7.12.0': {},
},
- mappings: { properties: {}, _meta: { migrationMappingPropertyHashes: {} } },
+ mappings: mappingsWithUnknownType,
settings: {},
},
'.kibana_7.11.0_001': {
@@ -288,12 +292,37 @@ describe('migrations v2 model', () => {
sourceIndex: Option.some('.kibana_7.invalid.0_001'),
targetIndex: '.kibana_7.11.0_001',
});
+ // This snapshot asserts that we disable the unknown saved object
+ // type. Because it's mappings are disabled, we also don't copy the
+ // `_meta.migrationMappingPropertyHashes` for the disabled type.
+ expect(newState.targetIndexMappings).toMatchInlineSnapshot(`
+ Object {
+ "_meta": Object {
+ "migrationMappingPropertyHashes": Object {
+ "new_saved_object_type": "4a11183eee21e6fbad864f7a30b39ad0",
+ },
+ },
+ "properties": Object {
+ "disabled_saved_object_type": Object {
+ "dynamic": false,
+ "properties": Object {},
+ },
+ "new_saved_object_type": Object {
+ "properties": Object {
+ "value": Object {
+ "type": "text",
+ },
+ },
+ },
+ },
+ }
+ `);
});
test('INIT -> SET_SOURCE_WRITE_BLOCK when migrating from a v2 migrations index (>= 7.11.0)', () => {
const res: ResponseType<'INIT'> = Either.right({
'.kibana_7.11.0_001': {
aliases: { '.kibana': {}, '.kibana_7.11.0': {} },
- mappings: { properties: {}, _meta: { migrationMappingPropertyHashes: {} } },
+ mappings: mappingsWithUnknownType,
settings: {},
},
'.kibana_3': {
@@ -319,6 +348,31 @@ describe('migrations v2 model', () => {
sourceIndex: Option.some('.kibana_7.11.0_001'),
targetIndex: '.kibana_7.12.0_001',
});
+ // This snapshot asserts that we disable the unknown saved object
+ // type. Because it's mappings are disabled, we also don't copy the
+ // `_meta.migrationMappingPropertyHashes` for the disabled type.
+ expect(newState.targetIndexMappings).toMatchInlineSnapshot(`
+ Object {
+ "_meta": Object {
+ "migrationMappingPropertyHashes": Object {
+ "new_saved_object_type": "4a11183eee21e6fbad864f7a30b39ad0",
+ },
+ },
+ "properties": Object {
+ "disabled_saved_object_type": Object {
+ "dynamic": false,
+ "properties": Object {},
+ },
+ "new_saved_object_type": Object {
+ "properties": Object {
+ "value": Object {
+ "type": "text",
+ },
+ },
+ },
+ },
+ }
+ `);
expect(newState.retryCount).toEqual(0);
expect(newState.retryDelay).toEqual(0);
});
@@ -328,7 +382,7 @@ describe('migrations v2 model', () => {
aliases: {
'.kibana': {},
},
- mappings: { properties: {}, _meta: { migrationMappingPropertyHashes: {} } },
+ mappings: mappingsWithUnknownType,
settings: {},
},
});
@@ -339,6 +393,31 @@ describe('migrations v2 model', () => {
sourceIndex: Option.some('.kibana_3'),
targetIndex: '.kibana_7.11.0_001',
});
+ // This snapshot asserts that we disable the unknown saved object
+ // type. Because it's mappings are disabled, we also don't copy the
+ // `_meta.migrationMappingPropertyHashes` for the disabled type.
+ expect(newState.targetIndexMappings).toMatchInlineSnapshot(`
+ Object {
+ "_meta": Object {
+ "migrationMappingPropertyHashes": Object {
+ "new_saved_object_type": "4a11183eee21e6fbad864f7a30b39ad0",
+ },
+ },
+ "properties": Object {
+ "disabled_saved_object_type": Object {
+ "dynamic": false,
+ "properties": Object {},
+ },
+ "new_saved_object_type": Object {
+ "properties": Object {
+ "value": Object {
+ "type": "text",
+ },
+ },
+ },
+ },
+ }
+ `);
expect(newState.retryCount).toEqual(0);
expect(newState.retryDelay).toEqual(0);
});
@@ -346,7 +425,7 @@ describe('migrations v2 model', () => {
const res: ResponseType<'INIT'> = Either.right({
'.kibana': {
aliases: {},
- mappings: { properties: {}, _meta: {} },
+ mappings: mappingsWithUnknownType,
settings: {},
},
});
@@ -357,6 +436,31 @@ describe('migrations v2 model', () => {
sourceIndex: Option.some('.kibana_pre6.5.0_001'),
targetIndex: '.kibana_7.11.0_001',
});
+ // This snapshot asserts that we disable the unknown saved object
+ // type. Because it's mappings are disabled, we also don't copy the
+ // `_meta.migrationMappingPropertyHashes` for the disabled type.
+ expect(newState.targetIndexMappings).toMatchInlineSnapshot(`
+ Object {
+ "_meta": Object {
+ "migrationMappingPropertyHashes": Object {
+ "new_saved_object_type": "4a11183eee21e6fbad864f7a30b39ad0",
+ },
+ },
+ "properties": Object {
+ "disabled_saved_object_type": Object {
+ "dynamic": false,
+ "properties": Object {},
+ },
+ "new_saved_object_type": Object {
+ "properties": Object {
+ "value": Object {
+ "type": "text",
+ },
+ },
+ },
+ },
+ }
+ `);
expect(newState.retryCount).toEqual(0);
expect(newState.retryDelay).toEqual(0);
});
@@ -366,7 +470,7 @@ describe('migrations v2 model', () => {
aliases: {
'my-saved-objects': {},
},
- mappings: { properties: {}, _meta: { migrationMappingPropertyHashes: {} } },
+ mappings: mappingsWithUnknownType,
settings: {},
},
});
@@ -386,6 +490,31 @@ describe('migrations v2 model', () => {
sourceIndex: Option.some('my-saved-objects_3'),
targetIndex: 'my-saved-objects_7.11.0_001',
});
+ // This snapshot asserts that we disable the unknown saved object
+ // type. Because it's mappings are disabled, we also don't copy the
+ // `_meta.migrationMappingPropertyHashes` for the disabled type.
+ expect(newState.targetIndexMappings).toMatchInlineSnapshot(`
+ Object {
+ "_meta": Object {
+ "migrationMappingPropertyHashes": Object {
+ "new_saved_object_type": "4a11183eee21e6fbad864f7a30b39ad0",
+ },
+ },
+ "properties": Object {
+ "disabled_saved_object_type": Object {
+ "dynamic": false,
+ "properties": Object {},
+ },
+ "new_saved_object_type": Object {
+ "properties": Object {
+ "value": Object {
+ "type": "text",
+ },
+ },
+ },
+ },
+ }
+ `);
expect(newState.retryCount).toEqual(0);
expect(newState.retryDelay).toEqual(0);
});
@@ -395,7 +524,7 @@ describe('migrations v2 model', () => {
aliases: {
'my-saved-objects': {},
},
- mappings: { properties: {}, _meta: { migrationMappingPropertyHashes: {} } },
+ mappings: mappingsWithUnknownType,
settings: {},
},
});
@@ -416,6 +545,31 @@ describe('migrations v2 model', () => {
sourceIndex: Option.some('my-saved-objects_7.11.0'),
targetIndex: 'my-saved-objects_7.12.0_001',
});
+ // This snapshot asserts that we disable the unknown saved object
+ // type. Because it's mappings are disabled, we also don't copy the
+ // `_meta.migrationMappingPropertyHashes` for the disabled type.
+ expect(newState.targetIndexMappings).toMatchInlineSnapshot(`
+ Object {
+ "_meta": Object {
+ "migrationMappingPropertyHashes": Object {
+ "new_saved_object_type": "4a11183eee21e6fbad864f7a30b39ad0",
+ },
+ },
+ "properties": Object {
+ "disabled_saved_object_type": Object {
+ "dynamic": false,
+ "properties": Object {},
+ },
+ "new_saved_object_type": Object {
+ "properties": Object {
+ "value": Object {
+ "type": "text",
+ },
+ },
+ },
+ },
+ }
+ `);
expect(newState.retryCount).toEqual(0);
expect(newState.retryDelay).toEqual(0);
});
diff --git a/src/core/server/saved_objects/migrationsv2/model.ts b/src/core/server/saved_objects/migrationsv2/model.ts
index 1119edde8e268..3556bb611bb67 100644
--- a/src/core/server/saved_objects/migrationsv2/model.ts
+++ b/src/core/server/saved_objects/migrationsv2/model.ts
@@ -60,13 +60,13 @@ function throwBadResponse(state: State, res: any): never {
* Merge the _meta.migrationMappingPropertyHashes mappings of an index with
* the given target mappings.
*
- * @remarks Mapping updates are commutative (deeply merged) by Elasticsearch,
- * except for the _meta key. The source index we're migrating from might
- * contain documents created by a plugin that is disabled in the Kibana
- * instance performing this migration. We merge the
- * _meta.migrationMappingPropertyHashes mappings from the source index into
- * the targetMappings to ensure that any `migrationPropertyHashes` for
- * disabled plugins aren't lost.
+ * @remarks When another instance already completed a migration, the existing
+ * target index might contain documents and mappings created by a plugin that
+ * is disabled in the current Kibana instance performing this migration.
+ * Mapping updates are commutative (deeply merged) by Elasticsearch, except
+ * for the `_meta` key. By merging the `_meta.migrationMappingPropertyHashes`
+ * mappings from the existing target index index into the targetMappings we
+ * ensure that any `migrationPropertyHashes` for disabled plugins aren't lost.
*
* Right now we don't use these `migrationPropertyHashes` but it could be used
* in the future to detect if mappings were changed. If mappings weren't
@@ -209,7 +209,7 @@ export const model = (currentState: State, resW: ResponseTypeDuration
| The interval between health check requests Kibana sends to the Elasticsearch. |
| [hosts](./kibana-plugin-core-server.elasticsearchconfig.hosts.md) | | string[]
| Hosts that the client will connect to. If sniffing is enabled, this list will be used as seeds to discover the rest of your cluster. |
| [ignoreVersionMismatch](./kibana-plugin-core-server.elasticsearchconfig.ignoreversionmismatch.md) | | boolean
| Whether to allow kibana to connect to a non-compatible elasticsearch node. |
-| [logQueries](./kibana-plugin-core-server.elasticsearchconfig.logqueries.md) | | boolean
| Specifies whether all queries to the client should be logged (status code, method, query etc.). |
| [password](./kibana-plugin-core-server.elasticsearchconfig.password.md) | | string
| If Elasticsearch is protected with basic authentication, this setting provides the password that the Kibana server uses to perform its administrative functions. |
| [pingTimeout](./kibana-plugin-core-server.elasticsearchconfig.pingtimeout.md) | | Duration
| Timeout after which PING HTTP request will be aborted and retried. |
| [requestHeadersWhitelist](./kibana-plugin-core-server.elasticsearchconfig.requestheaderswhitelist.md) | | string[]
| List of Kibana client-side headers to send to Elasticsearch when request scoped cluster client is used. If this is an empty array then \*no\* client-side will be sent. |
diff --git a/docs/development/core/server/kibana-plugin-core-server.legacyclusterclient._constructor_.md b/docs/development/core/server/kibana-plugin-core-server.legacyclusterclient._constructor_.md
index 823f34bd7dd23..ed2763d980279 100644
--- a/docs/development/core/server/kibana-plugin-core-server.legacyclusterclient._constructor_.md
+++ b/docs/development/core/server/kibana-plugin-core-server.legacyclusterclient._constructor_.md
@@ -9,7 +9,7 @@ Constructs a new instance of the `LegacyClusterClient` class
Signature:
```typescript
-constructor(config: LegacyElasticsearchClientConfig, log: Logger, getAuthHeaders?: GetAuthHeaders);
+constructor(config: LegacyElasticsearchClientConfig, log: Logger, type: string, getAuthHeaders?: GetAuthHeaders);
```
## Parameters
@@ -18,5 +18,6 @@ constructor(config: LegacyElasticsearchClientConfig, log: Logger, getAuthHeaders
| --- | --- | --- |
| config | LegacyElasticsearchClientConfig
| |
| log | Logger
| |
+| type | string
| |
| getAuthHeaders | GetAuthHeaders
| |
diff --git a/docs/development/core/server/kibana-plugin-core-server.legacyclusterclient.md b/docs/development/core/server/kibana-plugin-core-server.legacyclusterclient.md
index d24aeb44ca86a..0872e5ba7c219 100644
--- a/docs/development/core/server/kibana-plugin-core-server.legacyclusterclient.md
+++ b/docs/development/core/server/kibana-plugin-core-server.legacyclusterclient.md
@@ -21,7 +21,7 @@ export declare class LegacyClusterClient implements ILegacyClusterClient
| Constructor | Modifiers | Description |
| --- | --- | --- |
-| [(constructor)(config, log, getAuthHeaders)](./kibana-plugin-core-server.legacyclusterclient._constructor_.md) | | Constructs a new instance of the LegacyClusterClient
class |
+| [(constructor)(config, log, type, getAuthHeaders)](./kibana-plugin-core-server.legacyclusterclient._constructor_.md) | | Constructs a new instance of the LegacyClusterClient
class |
## Properties
diff --git a/docs/development/core/server/kibana-plugin-core-server.legacyelasticsearchclientconfig.md b/docs/development/core/server/kibana-plugin-core-server.legacyelasticsearchclientconfig.md
index 78f7bf582d355..b028a09bee453 100644
--- a/docs/development/core/server/kibana-plugin-core-server.legacyelasticsearchclientconfig.md
+++ b/docs/development/core/server/kibana-plugin-core-server.legacyelasticsearchclientconfig.md
@@ -11,7 +11,7 @@
Signature:
```typescript
-export declare type LegacyElasticsearchClientConfig = Pick
-
- Once content sources are shared with you, they will be displayed here, and available - via the search experience. -
- } + title={{SHARED_EMPTY_DESCRIPTION}
} />Contact your search experience administrator for more information.
+{LICENSE_CALLOUT_DESCRIPTION}
- Your organization’s license level has changed. Your data is safe, but document-level - permissions are no longer supported and searching of this source has been disabled. - Upgrade to a Platinum license to re-enable this source. -
+{SOURCE_DISABLED_CALLOUT_DESCRIPTION}
- {addedSourceName} has been successfully connected and initial content synchronization
- is already underway. Since you have elected to synchronize document-level permission
- information, you must now provide user and group mappings using the
-
- Documents will not be searchable from Workplace Search until user and group mappings
- have been configured.
-
{i18n.YOU_ARE_EDITING_A_NOTE}
-{i18n.YOU_ARE_EDITING_A_NOTE}
+AbortSignal
| An AbortSignal
that allows the caller of search
to abort a search request. |
| [isRestore](./kibana-plugin-plugins-data-public.isearchoptions.isrestore.md) | boolean
| Whether the session is restored (i.e. search requests should re-use the stored search IDs, rather than starting from scratch) |
| [isStored](./kibana-plugin-plugins-data-public.isearchoptions.isstored.md) | boolean
| Whether the session is already saved (i.e. sent to background) |
+| [legacyHitsTotal](./kibana-plugin-plugins-data-public.isearchoptions.legacyhitstotal.md) | boolean
| Request the legacy format for the total number of hits. If sending rest_total_hits_as_int
to something other than true
, this should be set to false
. |
| [sessionId](./kibana-plugin-plugins-data-public.isearchoptions.sessionid.md) | string
| A session ID, grouping multiple search requests into a single session. |
| [strategy](./kibana-plugin-plugins-data-public.isearchoptions.strategy.md) | string
| Use this option to force using a specific server side search strategy. Leave empty to use the default strategy. |
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iscopedsessionservice.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iscopedsessionservice.md
new file mode 100644
index 0000000000000..eaac671b9a182
--- /dev/null
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iscopedsessionservice.md
@@ -0,0 +1,18 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IScopedSessionService](./kibana-plugin-plugins-data-server.iscopedsessionservice.md)
+
+## IScopedSessionService interface
+
+Signature:
+
+```typescript
+export interface IScopedSessionService
+```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [search](./kibana-plugin-plugins-data-server.iscopedsessionservice.search.md) | <Request extends IKibanaSearchRequest, Response extends IKibanaSearchResponse>(strategy: ISearchStrategy<Request, Response>, ...args: Parameters<ISearchStrategy<Request, Response>['search']>) => Observable<Response>
| |
+
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iscopedsessionservice.search.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iscopedsessionservice.search.md
new file mode 100644
index 0000000000000..d58a9fd9f3761
--- /dev/null
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iscopedsessionservice.search.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IScopedSessionService](./kibana-plugin-plugins-data-server.iscopedsessionservice.md) > [search](./kibana-plugin-plugins-data-server.iscopedsessionservice.search.md)
+
+## IScopedSessionService.search property
+
+Signature:
+
+```typescript
+search: AbortSignal
| An AbortSignal
that allows the caller of search
to abort a search request. |
| [isRestore](./kibana-plugin-plugins-data-server.isearchoptions.isrestore.md) | boolean
| Whether the session is restored (i.e. search requests should re-use the stored search IDs, rather than starting from scratch) |
| [isStored](./kibana-plugin-plugins-data-server.isearchoptions.isstored.md) | boolean
| Whether the session is already saved (i.e. sent to background) |
+| [legacyHitsTotal](./kibana-plugin-plugins-data-server.isearchoptions.legacyhitstotal.md) | boolean
| Request the legacy format for the total number of hits. If sending rest_total_hits_as_int
to something other than true
, this should be set to false
. |
| [sessionId](./kibana-plugin-plugins-data-server.isearchoptions.sessionid.md) | string
| A session ID, grouping multiple search requests into a single session. |
| [strategy](./kibana-plugin-plugins-data-server.isearchoptions.strategy.md) | string
| Use this option to force using a specific server side search strategy. Leave empty to use the default strategy. |
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md
index 84c7875c26ce8..27a386a714fc1 100644
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md
@@ -53,6 +53,7 @@
| [IFieldSubType](./kibana-plugin-plugins-data-server.ifieldsubtype.md) | |
| [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) | |
| [IndexPatternAttributes](./kibana-plugin-plugins-data-server.indexpatternattributes.md) | Interface for an index pattern saved object |
+| [IScopedSessionService](./kibana-plugin-plugins-data-server.iscopedsessionservice.md) | |
| [ISearchOptions](./kibana-plugin-plugins-data-server.isearchoptions.md) | |
| [ISearchSetup](./kibana-plugin-plugins-data-server.isearchsetup.md) | |
| [ISearchStart](./kibana-plugin-plugins-data-server.isearchstart.md) | |
diff --git a/src/plugins/data/common/search/types.ts b/src/plugins/data/common/search/types.ts
index c1293f4415458..38e963591f25c 100644
--- a/src/plugins/data/common/search/types.ts
+++ b/src/plugins/data/common/search/types.ts
@@ -84,11 +84,18 @@ export interface ISearchOptions {
* An `AbortSignal` that allows the caller of `search` to abort a search request.
*/
abortSignal?: AbortSignal;
+
/**
* Use this option to force using a specific server side search strategy. Leave empty to use the default strategy.
*/
strategy?: string;
+ /**
+ * Request the legacy format for the total number of hits. If sending `rest_total_hits_as_int` to
+ * something other than `true`, this should be set to `false`.
+ */
+ legacyHitsTotal?: boolean;
+
/**
* A session ID, grouping multiple search requests into a single session.
*/
diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md
index f533af2db9672..4f197dd43a83e 100644
--- a/src/plugins/data/public/public.api.md
+++ b/src/plugins/data/public/public.api.md
@@ -1641,6 +1641,7 @@ export interface ISearchOptions {
abortSignal?: AbortSignal;
isRestore?: boolean;
isStored?: boolean;
+ legacyHitsTotal?: boolean;
sessionId?: string;
strategy?: string;
}
diff --git a/src/plugins/data/server/index.ts b/src/plugins/data/server/index.ts
index 27af11674d061..370ff180fa562 100644
--- a/src/plugins/data/server/index.ts
+++ b/src/plugins/data/server/index.ts
@@ -235,6 +235,7 @@ export {
SearchUsage,
SessionService,
ISessionService,
+ IScopedSessionService,
DataApiRequestHandlerContext,
DataRequestHandlerContext,
} from './search';
diff --git a/src/plugins/data/server/search/es_search/es_search_strategy.ts b/src/plugins/data/server/search/es_search/es_search_strategy.ts
index c176a50627b92..2d9b16ac8b00b 100644
--- a/src/plugins/data/server/search/es_search/es_search_strategy.ts
+++ b/src/plugins/data/server/search/es_search/es_search_strategy.ts
@@ -13,7 +13,7 @@ import type { Logger, SharedGlobalConfig } from 'kibana/server';
import type { ISearchStrategy } from '../types';
import type { SearchUsage } from '../collectors';
import { getDefaultSearchParams, getShardTimeout, shimAbortSignal } from './request_utils';
-import { toKibanaSearchResponse } from './response_utils';
+import { shimHitsTotal, toKibanaSearchResponse } from './response_utils';
import { searchUsageObserver } from '../collectors/usage';
import { getKbnServerError, KbnServerError } from '../../../../kibana_utils/server';
@@ -29,7 +29,7 @@ export const esSearchStrategyProvider = (
* @throws `KbnServerError`
* @returns `Observablestring
| |
-
-Returns:
-
-`DecoratedError`
-
diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorateindexaliasnotfounderror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorateindexaliasnotfounderror.md
deleted file mode 100644
index c7e10fc42ead1..0000000000000
--- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorateindexaliasnotfounderror.md
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SavedObjectsErrorHelpers](./kibana-plugin-core-server.savedobjectserrorhelpers.md) > [decorateIndexAliasNotFoundError](./kibana-plugin-core-server.savedobjectserrorhelpers.decorateindexaliasnotfounderror.md)
-
-## SavedObjectsErrorHelpers.decorateIndexAliasNotFoundError() method
-
-Signature:
-
-```typescript
-static decorateIndexAliasNotFoundError(error: Error, alias: string): DecoratedError;
-```
-
-## Parameters
-
-| Parameter | Type | Description |
-| --- | --- | --- |
-| error | Error
| |
-| alias | string
| |
-
-Returns:
-
-`DecoratedError`
-
diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isgeneralerror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isgeneralerror.md
deleted file mode 100644
index 4b4ede2f77a7e..0000000000000
--- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isgeneralerror.md
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SavedObjectsErrorHelpers](./kibana-plugin-core-server.savedobjectserrorhelpers.md) > [isGeneralError](./kibana-plugin-core-server.savedobjectserrorhelpers.isgeneralerror.md)
-
-## SavedObjectsErrorHelpers.isGeneralError() method
-
-Signature:
-
-```typescript
-static isGeneralError(error: Error | DecoratedError): boolean;
-```
-
-## Parameters
-
-| Parameter | Type | Description |
-| --- | --- | --- |
-| error | Error | DecoratedError
| |
-
-Returns:
-
-`boolean`
-
diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.md
index 2dc78f2df3a83..9b69012ed5f12 100644
--- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.md
+++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.md
@@ -18,7 +18,6 @@ export declare class SavedObjectsErrorHelpers
| [createBadRequestError(reason)](./kibana-plugin-core-server.savedobjectserrorhelpers.createbadrequesterror.md) | static
| |
| [createConflictError(type, id, reason)](./kibana-plugin-core-server.savedobjectserrorhelpers.createconflicterror.md) | static
| |
| [createGenericNotFoundError(type, id)](./kibana-plugin-core-server.savedobjectserrorhelpers.creategenericnotfounderror.md) | static
| |
-| [createIndexAliasNotFoundError(alias)](./kibana-plugin-core-server.savedobjectserrorhelpers.createindexaliasnotfounderror.md) | static
| |
| [createInvalidVersionError(versionInput)](./kibana-plugin-core-server.savedobjectserrorhelpers.createinvalidversionerror.md) | static
| |
| [createTooManyRequestsError(type, id)](./kibana-plugin-core-server.savedobjectserrorhelpers.createtoomanyrequestserror.md) | static
| |
| [createUnsupportedTypeError(type)](./kibana-plugin-core-server.savedobjectserrorhelpers.createunsupportedtypeerror.md) | static
| |
@@ -28,7 +27,6 @@ export declare class SavedObjectsErrorHelpers
| [decorateEsUnavailableError(error, reason)](./kibana-plugin-core-server.savedobjectserrorhelpers.decorateesunavailableerror.md) | static
| |
| [decorateForbiddenError(error, reason)](./kibana-plugin-core-server.savedobjectserrorhelpers.decorateforbiddenerror.md) | static
| |
| [decorateGeneralError(error, reason)](./kibana-plugin-core-server.savedobjectserrorhelpers.decorategeneralerror.md) | static
| |
-| [decorateIndexAliasNotFoundError(error, alias)](./kibana-plugin-core-server.savedobjectserrorhelpers.decorateindexaliasnotfounderror.md) | static
| |
| [decorateNotAuthorizedError(error, reason)](./kibana-plugin-core-server.savedobjectserrorhelpers.decoratenotauthorizederror.md) | static
| |
| [decorateRequestEntityTooLargeError(error, reason)](./kibana-plugin-core-server.savedobjectserrorhelpers.decoraterequestentitytoolargeerror.md) | static
| |
| [decorateTooManyRequestsError(error, reason)](./kibana-plugin-core-server.savedobjectserrorhelpers.decoratetoomanyrequestserror.md) | static
| |
@@ -37,7 +35,6 @@ export declare class SavedObjectsErrorHelpers
| [isEsCannotExecuteScriptError(error)](./kibana-plugin-core-server.savedobjectserrorhelpers.isescannotexecutescripterror.md) | static
| |
| [isEsUnavailableError(error)](./kibana-plugin-core-server.savedobjectserrorhelpers.isesunavailableerror.md) | static
| |
| [isForbiddenError(error)](./kibana-plugin-core-server.savedobjectserrorhelpers.isforbiddenerror.md) | static
| |
-| [isGeneralError(error)](./kibana-plugin-core-server.savedobjectserrorhelpers.isgeneralerror.md) | static
| |
| [isInvalidVersionError(error)](./kibana-plugin-core-server.savedobjectserrorhelpers.isinvalidversionerror.md) | static
| |
| [isNotAuthorizedError(error)](./kibana-plugin-core-server.savedobjectserrorhelpers.isnotauthorizederror.md) | static
| |
| [isNotFoundError(error)](./kibana-plugin-core-server.savedobjectserrorhelpers.isnotfounderror.md) | static
| |
diff --git a/packages/kbn-es-archiver/src/actions/empty_kibana_index.ts b/packages/kbn-es-archiver/src/actions/empty_kibana_index.ts
index 6272d6ba00ee8..56c75c5aca419 100644
--- a/packages/kbn-es-archiver/src/actions/empty_kibana_index.ts
+++ b/packages/kbn-es-archiver/src/actions/empty_kibana_index.ts
@@ -25,6 +25,5 @@ export async function emptyKibanaIndexAction({
await cleanKibanaIndices({ client, stats, log, kibanaPluginIds });
await migrateKibanaIndex({ client, kbnClient });
- stats.createdIndex('.kibana');
- return stats.toJSON();
+ return stats;
}
diff --git a/packages/kbn-es-archiver/src/es_archiver.ts b/packages/kbn-es-archiver/src/es_archiver.ts
index 8601dedad0e27..f101c5d6867f1 100644
--- a/packages/kbn-es-archiver/src/es_archiver.ts
+++ b/packages/kbn-es-archiver/src/es_archiver.ts
@@ -155,7 +155,7 @@ export class EsArchiver {
* @return Promise
*/
async emptyKibanaIndex() {
- return await emptyKibanaIndexAction({
+ await emptyKibanaIndexAction({
client: this.client,
log: this.log,
kbnClient: this.kbnClient,
diff --git a/packages/kbn-es-archiver/src/lib/indices/kibana_index.ts b/packages/kbn-es-archiver/src/lib/indices/kibana_index.ts
index 91c0bd8343a36..0459a4301cf6b 100644
--- a/packages/kbn-es-archiver/src/lib/indices/kibana_index.ts
+++ b/packages/kbn-es-archiver/src/lib/indices/kibana_index.ts
@@ -76,9 +76,7 @@ export async function migrateKibanaIndex({
*/
async function fetchKibanaIndices(client: Client) {
const kibanaIndices = await client.cat.indices({ index: '.kibana*', format: 'json' });
- const isKibanaIndex = (index: string) =>
- /^\.kibana(:?_\d*)?$/.test(index) ||
- /^\.kibana(_task_manager)?_(pre)?\d+\.\d+\.\d+/.test(index);
+ const isKibanaIndex = (index: string) => /^\.kibana(:?_\d*)?$/.test(index);
return kibanaIndices.map((x: { index: string }) => x.index).filter(isKibanaIndex);
}
@@ -105,7 +103,7 @@ export async function cleanKibanaIndices({
while (true) {
const resp = await client.deleteByQuery({
- index: `.kibana,.kibana_task_manager`,
+ index: `.kibana`,
body: {
query: {
bool: {
@@ -117,7 +115,7 @@ export async function cleanKibanaIndices({
},
},
},
- ignore: [404, 409],
+ ignore: [409],
});
if (resp.total !== resp.deleted) {
diff --git a/src/core/server/saved_objects/migrationsv2/model.test.ts b/src/core/server/saved_objects/migrationsv2/model.test.ts
index a9aa69960b1c2..d5ab85c54a728 100644
--- a/src/core/server/saved_objects/migrationsv2/model.test.ts
+++ b/src/core/server/saved_objects/migrationsv2/model.test.ts
@@ -182,21 +182,6 @@ describe('migrations v2 model', () => {
versionAlias: '.kibana_7.11.0',
versionIndex: '.kibana_7.11.0_001',
};
- const mappingsWithUnknownType = {
- properties: {
- disabled_saved_object_type: {
- properties: {
- value: { type: 'keyword' },
- },
- },
- },
- _meta: {
- migrationMappingPropertyHashes: {
- disabled_saved_object_type: '7997cf5a56cc02bdc9c93361bde732b0',
- },
- },
- };
-
test('INIT -> OUTDATED_DOCUMENTS_SEARCH if .kibana is already pointing to the target index', () => {
const res: ResponseType<'INIT'> = Either.right({
'.kibana_7.11.0_001': {
@@ -204,27 +189,38 @@ describe('migrations v2 model', () => {
'.kibana': {},
'.kibana_7.11.0': {},
},
- mappings: mappingsWithUnknownType,
+ mappings: {
+ properties: {
+ disabled_saved_object_type: {
+ properties: {
+ value: { type: 'keyword' },
+ },
+ },
+ },
+ _meta: {
+ migrationMappingPropertyHashes: {
+ disabled_saved_object_type: '7997cf5a56cc02bdc9c93361bde732b0',
+ },
+ },
+ },
settings: {},
},
});
const newState = model(initState, res);
expect(newState.controlState).toEqual('OUTDATED_DOCUMENTS_SEARCH');
- // This snapshot asserts that we merge the
- // migrationMappingPropertyHashes of the existing index, but we leave
- // the mappings for the disabled_saved_object_type untouched. There
- // might be another Kibana instance that knows about this type and
- // needs these mappings in place.
expect(newState.targetIndexMappings).toMatchInlineSnapshot(`
Object {
"_meta": Object {
"migrationMappingPropertyHashes": Object {
- "disabled_saved_object_type": "7997cf5a56cc02bdc9c93361bde732b0",
"new_saved_object_type": "4a11183eee21e6fbad864f7a30b39ad0",
},
},
"properties": Object {
+ "disabled_saved_object_type": Object {
+ "dynamic": false,
+ "properties": Object {},
+ },
"new_saved_object_type": Object {
"properties": Object {
"value": Object {
@@ -275,7 +271,7 @@ describe('migrations v2 model', () => {
'.kibana': {},
'.kibana_7.12.0': {},
},
- mappings: mappingsWithUnknownType,
+ mappings: { properties: {}, _meta: { migrationMappingPropertyHashes: {} } },
settings: {},
},
'.kibana_7.11.0_001': {
@@ -292,37 +288,12 @@ describe('migrations v2 model', () => {
sourceIndex: Option.some('.kibana_7.invalid.0_001'),
targetIndex: '.kibana_7.11.0_001',
});
- // This snapshot asserts that we disable the unknown saved object
- // type. Because it's mappings are disabled, we also don't copy the
- // `_meta.migrationMappingPropertyHashes` for the disabled type.
- expect(newState.targetIndexMappings).toMatchInlineSnapshot(`
- Object {
- "_meta": Object {
- "migrationMappingPropertyHashes": Object {
- "new_saved_object_type": "4a11183eee21e6fbad864f7a30b39ad0",
- },
- },
- "properties": Object {
- "disabled_saved_object_type": Object {
- "dynamic": false,
- "properties": Object {},
- },
- "new_saved_object_type": Object {
- "properties": Object {
- "value": Object {
- "type": "text",
- },
- },
- },
- },
- }
- `);
});
test('INIT -> SET_SOURCE_WRITE_BLOCK when migrating from a v2 migrations index (>= 7.11.0)', () => {
const res: ResponseType<'INIT'> = Either.right({
'.kibana_7.11.0_001': {
aliases: { '.kibana': {}, '.kibana_7.11.0': {} },
- mappings: mappingsWithUnknownType,
+ mappings: { properties: {}, _meta: { migrationMappingPropertyHashes: {} } },
settings: {},
},
'.kibana_3': {
@@ -348,31 +319,6 @@ describe('migrations v2 model', () => {
sourceIndex: Option.some('.kibana_7.11.0_001'),
targetIndex: '.kibana_7.12.0_001',
});
- // This snapshot asserts that we disable the unknown saved object
- // type. Because it's mappings are disabled, we also don't copy the
- // `_meta.migrationMappingPropertyHashes` for the disabled type.
- expect(newState.targetIndexMappings).toMatchInlineSnapshot(`
- Object {
- "_meta": Object {
- "migrationMappingPropertyHashes": Object {
- "new_saved_object_type": "4a11183eee21e6fbad864f7a30b39ad0",
- },
- },
- "properties": Object {
- "disabled_saved_object_type": Object {
- "dynamic": false,
- "properties": Object {},
- },
- "new_saved_object_type": Object {
- "properties": Object {
- "value": Object {
- "type": "text",
- },
- },
- },
- },
- }
- `);
expect(newState.retryCount).toEqual(0);
expect(newState.retryDelay).toEqual(0);
});
@@ -382,7 +328,7 @@ describe('migrations v2 model', () => {
aliases: {
'.kibana': {},
},
- mappings: mappingsWithUnknownType,
+ mappings: { properties: {}, _meta: { migrationMappingPropertyHashes: {} } },
settings: {},
},
});
@@ -393,31 +339,6 @@ describe('migrations v2 model', () => {
sourceIndex: Option.some('.kibana_3'),
targetIndex: '.kibana_7.11.0_001',
});
- // This snapshot asserts that we disable the unknown saved object
- // type. Because it's mappings are disabled, we also don't copy the
- // `_meta.migrationMappingPropertyHashes` for the disabled type.
- expect(newState.targetIndexMappings).toMatchInlineSnapshot(`
- Object {
- "_meta": Object {
- "migrationMappingPropertyHashes": Object {
- "new_saved_object_type": "4a11183eee21e6fbad864f7a30b39ad0",
- },
- },
- "properties": Object {
- "disabled_saved_object_type": Object {
- "dynamic": false,
- "properties": Object {},
- },
- "new_saved_object_type": Object {
- "properties": Object {
- "value": Object {
- "type": "text",
- },
- },
- },
- },
- }
- `);
expect(newState.retryCount).toEqual(0);
expect(newState.retryDelay).toEqual(0);
});
@@ -425,7 +346,7 @@ describe('migrations v2 model', () => {
const res: ResponseType<'INIT'> = Either.right({
'.kibana': {
aliases: {},
- mappings: mappingsWithUnknownType,
+ mappings: { properties: {}, _meta: {} },
settings: {},
},
});
@@ -436,31 +357,6 @@ describe('migrations v2 model', () => {
sourceIndex: Option.some('.kibana_pre6.5.0_001'),
targetIndex: '.kibana_7.11.0_001',
});
- // This snapshot asserts that we disable the unknown saved object
- // type. Because it's mappings are disabled, we also don't copy the
- // `_meta.migrationMappingPropertyHashes` for the disabled type.
- expect(newState.targetIndexMappings).toMatchInlineSnapshot(`
- Object {
- "_meta": Object {
- "migrationMappingPropertyHashes": Object {
- "new_saved_object_type": "4a11183eee21e6fbad864f7a30b39ad0",
- },
- },
- "properties": Object {
- "disabled_saved_object_type": Object {
- "dynamic": false,
- "properties": Object {},
- },
- "new_saved_object_type": Object {
- "properties": Object {
- "value": Object {
- "type": "text",
- },
- },
- },
- },
- }
- `);
expect(newState.retryCount).toEqual(0);
expect(newState.retryDelay).toEqual(0);
});
@@ -470,7 +366,7 @@ describe('migrations v2 model', () => {
aliases: {
'my-saved-objects': {},
},
- mappings: mappingsWithUnknownType,
+ mappings: { properties: {}, _meta: { migrationMappingPropertyHashes: {} } },
settings: {},
},
});
@@ -490,31 +386,6 @@ describe('migrations v2 model', () => {
sourceIndex: Option.some('my-saved-objects_3'),
targetIndex: 'my-saved-objects_7.11.0_001',
});
- // This snapshot asserts that we disable the unknown saved object
- // type. Because it's mappings are disabled, we also don't copy the
- // `_meta.migrationMappingPropertyHashes` for the disabled type.
- expect(newState.targetIndexMappings).toMatchInlineSnapshot(`
- Object {
- "_meta": Object {
- "migrationMappingPropertyHashes": Object {
- "new_saved_object_type": "4a11183eee21e6fbad864f7a30b39ad0",
- },
- },
- "properties": Object {
- "disabled_saved_object_type": Object {
- "dynamic": false,
- "properties": Object {},
- },
- "new_saved_object_type": Object {
- "properties": Object {
- "value": Object {
- "type": "text",
- },
- },
- },
- },
- }
- `);
expect(newState.retryCount).toEqual(0);
expect(newState.retryDelay).toEqual(0);
});
@@ -524,7 +395,7 @@ describe('migrations v2 model', () => {
aliases: {
'my-saved-objects': {},
},
- mappings: mappingsWithUnknownType,
+ mappings: { properties: {}, _meta: { migrationMappingPropertyHashes: {} } },
settings: {},
},
});
@@ -545,31 +416,6 @@ describe('migrations v2 model', () => {
sourceIndex: Option.some('my-saved-objects_7.11.0'),
targetIndex: 'my-saved-objects_7.12.0_001',
});
- // This snapshot asserts that we disable the unknown saved object
- // type. Because it's mappings are disabled, we also don't copy the
- // `_meta.migrationMappingPropertyHashes` for the disabled type.
- expect(newState.targetIndexMappings).toMatchInlineSnapshot(`
- Object {
- "_meta": Object {
- "migrationMappingPropertyHashes": Object {
- "new_saved_object_type": "4a11183eee21e6fbad864f7a30b39ad0",
- },
- },
- "properties": Object {
- "disabled_saved_object_type": Object {
- "dynamic": false,
- "properties": Object {},
- },
- "new_saved_object_type": Object {
- "properties": Object {
- "value": Object {
- "type": "text",
- },
- },
- },
- },
- }
- `);
expect(newState.retryCount).toEqual(0);
expect(newState.retryDelay).toEqual(0);
});
diff --git a/src/core/server/saved_objects/migrationsv2/model.ts b/src/core/server/saved_objects/migrationsv2/model.ts
index 3556bb611bb67..1119edde8e268 100644
--- a/src/core/server/saved_objects/migrationsv2/model.ts
+++ b/src/core/server/saved_objects/migrationsv2/model.ts
@@ -60,13 +60,13 @@ function throwBadResponse(state: State, res: any): never {
* Merge the _meta.migrationMappingPropertyHashes mappings of an index with
* the given target mappings.
*
- * @remarks When another instance already completed a migration, the existing
- * target index might contain documents and mappings created by a plugin that
- * is disabled in the current Kibana instance performing this migration.
- * Mapping updates are commutative (deeply merged) by Elasticsearch, except
- * for the `_meta` key. By merging the `_meta.migrationMappingPropertyHashes`
- * mappings from the existing target index index into the targetMappings we
- * ensure that any `migrationPropertyHashes` for disabled plugins aren't lost.
+ * @remarks Mapping updates are commutative (deeply merged) by Elasticsearch,
+ * except for the _meta key. The source index we're migrating from might
+ * contain documents created by a plugin that is disabled in the Kibana
+ * instance performing this migration. We merge the
+ * _meta.migrationMappingPropertyHashes mappings from the source index into
+ * the targetMappings to ensure that any `migrationPropertyHashes` for
+ * disabled plugins aren't lost.
*
* Right now we don't use these `migrationPropertyHashes` but it could be used
* in the future to detect if mappings were changed. If mappings weren't
@@ -209,7 +209,7 @@ export const model = (currentState: State, resW: ResponseType&yR0WqQYf~ z;l)D&QcEv~(6Vo{6l9~M0=Gdp-E_TyDZyXsL+Rkf?Xk40k1N}u-gSEZI%gU6tUqnx zYmA!{#eLO$c4lKg_?H8C>OC84MrFaHwp7)JE9g{^amBdGs_gD@s?Ut7BkQD=Dr2Dd z>G-^`n~b{Rh5$+IB_z4}j<|_s%vTUmd|lARA!NuK%Q#;CnO5a}9hwub>E&ilALJO2 z?KSksz1kgBmJDA#HJdT{#$(h4b}mp(5QN0VZh@2Mu<2ov0@Zu&2F2(08#4P4t`G0B4uACQ#}3oq{k!#IkGjzmDc%3IOma*=$3k*Y;|qfz!u>EV$;NZ2Gv{Pf_qz z$_`pCTXM$bFXA%_N|AFy{QEj0%|^Ut49B0I4ZmG+;)zovWXaG26Ulzvqp6Vx&5t~y zPT2D+=^0;bo`3i{m~A!7^BfaI%}8lk{4f_!{(OFgKpT|sp*Z1jnEKZP@W{S+r^;8p zSMZmcFENOXNMCXg^l@Kpo$|n3ITP_{c{TrYcP5h|yp!3lIaheC Wn9I{w?u9R`dRp`J5~NVEA|@61J|mxynB=|vs0^s>80LAVed z6rJpg+Xg`OR9Z)Bx%W$Hu2X!Rbb?3HtRgSMO!N+ s-6|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