Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] Data visualizer: Add icons for semantic text, sparse vector and dense vector #196069

Merged
merged 2 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions x-pack/plugins/data_visualizer/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ export const SUPPORTED_FIELD_TYPES = {
NESTED: 'nested',
STRING: 'string',
TEXT: 'text',
SEMANTIC_TEXT: 'semantic_text',
DENSE_VECTOR: 'dense_vector',
SPARSE_VECTOR: 'sparse_vector',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qn895 @rbrtj do you know if we should make the messaging consistent in Field Statistics with the message in the sidebar field list?

Screenshot 2024-10-14 at 12 10 21

Sidebar:
Screenshot 2024-10-14 at 12 12 34

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds good 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created separate issue to enhance the information displayed in the expanded row: #196177

VERSION: 'version',
UNKNOWN: 'unknown',
} as const;
Expand All @@ -73,3 +76,4 @@ export const featureTitle = i18n.translate('xpack.dataVisualizer.title', {
defaultMessage: 'Upload a file',
});
export const featureId = `file_data_visualizer`;
export const SUPPORTED_FIELD_TYPES_LIST: string[] = Object.values(SUPPORTED_FIELD_TYPES);
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import type { DataViewField } from '@kbn/data-views-plugin/public';
import { KBN_FIELD_TYPES } from '@kbn/field-types';
import { getFieldType } from '@kbn/field-utils/src/utils/get_field_type';
import { SUPPORTED_FIELD_TYPES } from '../../../../common/constants';
import { SUPPORTED_FIELD_TYPES, SUPPORTED_FIELD_TYPES_LIST } from '../../../../common/constants';

// convert kibana types to ML Job types
// this is needed because kibana types only have string and not text and keyword.
Expand All @@ -26,6 +26,15 @@ export function kbnTypeToSupportedType(field: DataViewField) {
}
break;

case KBN_FIELD_TYPES.UNKNOWN:
const maybeFieldType = field.esTypes?.[0];
if (maybeFieldType && SUPPORTED_FIELD_TYPES_LIST.includes(maybeFieldType)) {
type = maybeFieldType;
} else {
type = getFieldType(field);
}
break;

default:
type = getFieldType(field);
break;
Expand Down