diff --git a/src/server/saved_objects/migrations/core/call_cluster.ts b/src/server/saved_objects/migrations/core/call_cluster.ts index 109379f587405..0b388229834bf 100644 --- a/src/server/saved_objects/migrations/core/call_cluster.ts +++ b/src/server/saved_objects/migrations/core/call_cluster.ts @@ -67,6 +67,7 @@ export interface PutMappingOpts { body: DocMapping; index: string; type: string; + include_type_name?: boolean; } export interface PutTemplateOpts { @@ -87,6 +88,7 @@ export interface IndexOpts { export interface IndexCreationOpts { index: string; + include_type_name?: boolean; body?: { mappings?: IndexMapping; settings?: { diff --git a/src/server/saved_objects/migrations/core/elastic_index.ts b/src/server/saved_objects/migrations/core/elastic_index.ts index 9c65981e22809..ba6dafec3e5d9 100644 --- a/src/server/saved_objects/migrations/core/elastic_index.ts +++ b/src/server/saved_objects/migrations/core/elastic_index.ts @@ -222,7 +222,12 @@ export async function migrationsUpToDate( * @param {IndexMapping} mappings */ export function putMappings(callCluster: CallCluster, index: string, mappings: IndexMapping) { - return callCluster('indices.putMapping', { body: mappings.doc, index, type: ROOT_TYPE }); + return callCluster('indices.putMapping', { + body: mappings.doc, + index, + type: ROOT_TYPE, + include_type_name: true, + }); } export async function createIndex( @@ -230,7 +235,11 @@ export async function createIndex( index: string, mappings?: IndexMapping ) { - await callCluster('indices.create', { body: { mappings, settings }, index }); + await callCluster('indices.create', { + body: { mappings, settings }, + index, + include_type_name: true, + }); } export async function deleteIndex(callCluster: CallCluster, index: string) { diff --git a/src/server/saved_objects/migrations/core/index_migrator.test.ts b/src/server/saved_objects/migrations/core/index_migrator.test.ts index 423aca9fc8edb..ae8af7fa2db0f 100644 --- a/src/server/saved_objects/migrations/core/index_migrator.test.ts +++ b/src/server/saved_objects/migrations/core/index_migrator.test.ts @@ -53,6 +53,7 @@ describe('IndexMigrator', () => { }, }, index: '.kibana_1', + include_type_name: true, type: ROOT_TYPE, }); }); @@ -89,6 +90,7 @@ describe('IndexMigrator', () => { settings: { number_of_shards: 1, auto_expand_replicas: '0-1' }, }, index: '.kibana_1', + include_type_name: true, }); }); @@ -175,6 +177,7 @@ describe('IndexMigrator', () => { }, }, }, + include_type_name: true, }); await new IndexMigrator(opts).migrate(); @@ -201,6 +204,7 @@ describe('IndexMigrator', () => { settings: { number_of_shards: 1, auto_expand_replicas: '0-1' }, }, index: '.kibana_2', + include_type_name: true, }); }); diff --git a/src/server/saved_objects/service/create_saved_objects_service.js b/src/server/saved_objects/service/create_saved_objects_service.js index c57d45effa8d7..7432c92d52f44 100644 --- a/src/server/saved_objects/service/create_saved_objects_service.js +++ b/src/server/saved_objects/service/create_saved_objects_service.js @@ -38,6 +38,7 @@ export function createSavedObjectsService(server, schema, serializer, migrator) const index = server.config().get('kibana.index'); await adminCluster.callWithInternalUser('indices.putTemplate', { name: `kibana_index_template:${index}`, + include_type_name: true, body: { template: index, settings: {