diff --git a/packages/kbn-field-utils/src/utils/field_types.ts b/packages/kbn-field-utils/src/utils/field_types.ts index 88d1a46949494..1d2649552479e 100644 --- a/packages/kbn-field-utils/src/utils/field_types.ts +++ b/packages/kbn-field-utils/src/utils/field_types.ts @@ -36,6 +36,7 @@ export enum KNOWN_FIELD_TYPES { RANK_FEATURES = 'rank_features', POINT = 'point', SHAPE = 'shape', + SPARSE_VECTOR = 'sparse_vector', STRING = 'string', TEXT = 'text', VERSION = 'version', diff --git a/packages/kbn-field-utils/src/utils/get_field_type_description.ts b/packages/kbn-field-utils/src/utils/get_field_type_description.ts index 3049da4304ec7..332f013b90db7 100644 --- a/packages/kbn-field-utils/src/utils/get_field_type_description.ts +++ b/packages/kbn-field-utils/src/utils/get_field_type_description.ts @@ -118,6 +118,10 @@ export function getFieldTypeDescription(type?: string) { return i18n.translate('fieldUtils.fieldNameDescription.shapeField', { defaultMessage: 'Arbitrary cartesian geometries.', }); + case KNOWN_FIELD_TYPES.SPARSE_VECTOR: + return i18n.translate('fieldUtils.fieldNameDescription.sparseVectorField', { + defaultMessage: 'Records sparse vectors of float values.', + }); case KNOWN_FIELD_TYPES.STRING: return i18n.translate('fieldUtils.fieldNameDescription.stringField', { defaultMessage: 'Full text such as the body of an email or a product description.', diff --git a/packages/kbn-field-utils/src/utils/get_field_type_name.ts b/packages/kbn-field-utils/src/utils/get_field_type_name.ts index 65ce720385b8e..bdf88897958b9 100644 --- a/packages/kbn-field-utils/src/utils/get_field_type_name.ts +++ b/packages/kbn-field-utils/src/utils/get_field_type_name.ts @@ -123,6 +123,10 @@ export function getFieldTypeName(type?: string) { return i18n.translate('fieldUtils.fieldNameIcons.shapeFieldAriaLabel', { defaultMessage: 'Shape', }); + case KNOWN_FIELD_TYPES.SPARSE_VECTOR: + return i18n.translate('fieldUtils.fieldNameIcons.sparseVectorFieldAriaLabel', { + defaultMessage: 'Sparse vector', + }); case KNOWN_FIELD_TYPES.STRING: return i18n.translate('fieldUtils.fieldNameIcons.stringFieldAriaLabel', { defaultMessage: 'String', diff --git a/packages/kbn-react-field/src/field_icon/__snapshots__/field_icon.test.tsx.snap b/packages/kbn-react-field/src/field_icon/__snapshots__/field_icon.test.tsx.snap index ada9724ca04e5..d33152540f7ea 100644 --- a/packages/kbn-react-field/src/field_icon/__snapshots__/field_icon.test.tsx.snap +++ b/packages/kbn-react-field/src/field_icon/__snapshots__/field_icon.test.tsx.snap @@ -275,6 +275,16 @@ exports[`FieldIcon renders known field types shape is rendered 1`] = ` /> `; +exports[`FieldIcon renders known field types sparse_vector is rendered 1`] = ` + +`; + exports[`FieldIcon renders known field types string is rendered 1`] = ` { | '_source' | 'point' | 'shape' + | 'sparse_vector' | 'string' | string | 'nested' @@ -69,6 +70,7 @@ export const typeToEuiIconMap: Partial> = { _source: { iconType: 'editorCodeBlock', color: 'gray' }, point: { iconType: 'tokenShape' }, // there is no separate icon for `point` yet shape: { iconType: 'tokenShape' }, + sparse_vector: { iconType: 'tokenDenseVector' }, string: { iconType: 'tokenString' }, text: { iconType: 'tokenString' }, keyword: { iconType: 'tokenKeyword' }, diff --git a/x-pack/plugins/enterprise_search/server/lib/indices/pipelines/ml_inference/update_ml_inference_mappings.test.ts b/x-pack/plugins/enterprise_search/server/lib/indices/pipelines/ml_inference/update_ml_inference_mappings.test.ts index 59699929ec313..bb9d7395c58e5 100644 --- a/x-pack/plugins/enterprise_search/server/lib/indices/pipelines/ml_inference/update_ml_inference_mappings.test.ts +++ b/x-pack/plugins/enterprise_search/server/lib/indices/pipelines/ml_inference/update_ml_inference_mappings.test.ts @@ -44,7 +44,7 @@ describe('updateMlInferenceMappings', () => { input_one_expanded: { properties: { predicted_value: { - type: 'rank_features', + type: 'sparse_vector', }, model_id: { type: 'keyword', @@ -54,7 +54,7 @@ describe('updateMlInferenceMappings', () => { input_two_expanded: { properties: { predicted_value: { - type: 'rank_features', + type: 'sparse_vector', }, model_id: { type: 'keyword', diff --git a/x-pack/plugins/enterprise_search/server/lib/indices/pipelines/ml_inference/update_ml_inference_mappings.ts b/x-pack/plugins/enterprise_search/server/lib/indices/pipelines/ml_inference/update_ml_inference_mappings.ts index 3cc2ef3c2ed4f..fa8d06bde503f 100644 --- a/x-pack/plugins/enterprise_search/server/lib/indices/pipelines/ml_inference/update_ml_inference_mappings.ts +++ b/x-pack/plugins/enterprise_search/server/lib/indices/pipelines/ml_inference/update_ml_inference_mappings.ts @@ -77,7 +77,7 @@ const generateTextExpansionMappingProperties = (sourceFields: string[], targetFi type: 'keyword', }, predicted_value: { - type: 'rank_features', + type: 'sparse_vector', }, }, }, @@ -97,7 +97,7 @@ const formDefaultElserMappingProps = (sourceFields: string[]) => { type: 'keyword', }, predicted_value: { - type: 'rank_features', + type: 'sparse_vector', }, }, }, diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/constants/data_types_definition.tsx b/x-pack/plugins/index_management/public/application/components/mappings_editor/constants/data_types_definition.tsx index 89043c9fd7e69..8035b6af08b48 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/constants/data_types_definition.tsx +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/constants/data_types_definition.tsx @@ -851,6 +851,23 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {

), }, + sparse_vector: { + label: i18n.translate('xpack.idxMgmt.mappingsEditor.dataType.sparseVectorDescription', { + defaultMessage: 'Sparse vector', + }), + value: 'sparse_vector', + documentation: { + main: 'sparse-vector.html', + }, + description: () => ( +

+ +

+ ), + }, point: { label: i18n.translate('xpack.idxMgmt.mappingsEditor.dataType.pointDescription', { defaultMessage: 'Point', @@ -958,6 +975,7 @@ export const MAIN_TYPES: MainType[] = [ 'rank_features', 'search_as_you_type', 'shape', + 'sparse_vector', 'text', 'token_count', 'histogram', diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/types/document_fields.ts b/x-pack/plugins/index_management/public/application/components/mappings_editor/types/document_fields.ts index 5f6f4c6728be0..e62414f23e3f2 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/types/document_fields.ts +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/types/document_fields.ts @@ -58,6 +58,7 @@ export type MainType = | 'rank_features' | 'shape' | 'search_as_you_type' + | 'sparse_vector' | 'date' | 'date_nanos' | 'geo_point'