From 91504eee86e6951563673afa1933a712485f1fe1 Mon Sep 17 00:00:00 2001 From: Elena Stoeva Date: Fri, 2 Jun 2023 12:37:36 +0100 Subject: [PATCH] Fix subtype parameter --- .../field_parameters/subtype_parameter.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/subtype_parameter.tsx b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/subtype_parameter.tsx index 404deb6356d82..21c195e1180aa 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/subtype_parameter.tsx +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/subtype_parameter.tsx @@ -85,7 +85,13 @@ export const SubTypeParameter = ({ : filterTypesForNonRootFields(subTypeOptions!) } selectedOptions={subTypeField.value as ComboBoxOption[]} - onChange={subTypeField.setValue} + onChange={(value) => { + if (value.length === 0) { + // Don't allow clearing the type. One must always be selected + return; + } + subTypeField.setValue(value); + }} isClearable={false} data-test-subj="fieldSubType" />