diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/index.ts b/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/index.ts index 0bf190948ed84..a796a2d1124b4 100644 --- a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/index.ts +++ b/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/index.ts @@ -12,4 +12,4 @@ export * from './components/load_mappings'; export { OnUpdateHandler, Types } from './mappings_state'; -export { doesMappingsHasType } from './lib'; +export { doMappingsHaveType } from './lib'; diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/extract_mappings_definition.ts b/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/extract_mappings_definition.ts index d14dfba766470..9f2a3226b69e0 100644 --- a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/extract_mappings_definition.ts +++ b/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/extract_mappings_definition.ts @@ -52,7 +52,7 @@ const getMappingsDefinitionWithType = (mappings: GenericObject): MappingsWithTyp return typedMappings; }; -export const doesMappingsHasType = (mappings: GenericObject = {}): boolean => +export const doMappingsHaveType = (mappings: GenericObject = {}): boolean => getMappingsDefinitionWithType(mappings).filter(({ type }) => type !== undefined).length > 0; /** diff --git a/x-pack/legacy/plugins/index_management/public/app/services/api.ts b/x-pack/legacy/plugins/index_management/public/app/services/api.ts index 3c04e92365b94..d28047825af18 100644 --- a/x-pack/legacy/plugins/index_management/public/app/services/api.ts +++ b/x-pack/legacy/plugins/index_management/public/app/services/api.ts @@ -38,7 +38,7 @@ import { uiMetricService } from './ui_metric'; import { useRequest, sendRequest } from './use_request'; import { httpService } from './http'; import { Template } from '../../../common/types'; -import { doesMappingsHasType } from '../components/mappings_editor'; +import { doMappingsHaveType } from '../components/mappings_editor'; let httpClient: ng.IHttpService; @@ -230,7 +230,7 @@ export function loadIndexTemplate(name: Template['name']) { } export async function saveTemplate(template: Template, isClone?: boolean) { - const includeTypeName = doesMappingsHasType(template.mappings); + const includeTypeName = doMappingsHaveType(template.mappings); const result = await sendRequest({ path: `${API_BASE_PATH}/templates`, method: 'put', @@ -248,7 +248,7 @@ export async function saveTemplate(template: Template, isClone?: boolean) { } export async function updateTemplate(template: Template) { - const includeTypeName = doesMappingsHasType(template.mappings); + const includeTypeName = doMappingsHaveType(template.mappings); const { name } = template; const result = await sendRequest({ path: `${API_BASE_PATH}/templates/${encodeURIComponent(name)}`,