Skip to content

Commit

Permalink
[8.x] [ML] Data visualizer: Add icons for semantic text, sparse vecto…
Browse files Browse the repository at this point in the history
…r and dense vector (#196069) (#196238)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[ML] Data visualizer: Add icons for semantic text, sparse vector and
dense vector (#196069)](#196069)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Robert
Jaszczurek","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-15T07:52:06Z","message":"[ML]
Data visualizer: Add icons for semantic text, sparse vector and dense
vector (#196069)\n\n## Summary\r\n\r\nAdded support for `semantic_text`,
`sparse_vector` and `dense_vector` in\r\nthe Data visualizer and Field
Statistics.\r\nFor
[#192161](https://github.com/elastic/kibana/issues/192161)\r\n\r\n\r\n|
Before | After |\r\n| ------------- | -------------
|\r\n|\r\n![image](https://github.com/user-attachments/assets/d87de954-bae0-46d3-9934-e6e6a6424ee0)\r\n|\r\n![image](https://github.com/user-attachments/assets/a6fced39-e227-43ea-9062-9add27aad8fd)\r\n|\r\n|\r\n![image](https://github.com/user-attachments/assets/4c8005e3-439f-4dfc-898b-8158835d803f)\r\n|\r\n![image](https://github.com/user-attachments/assets/a9d501cc-84f9-4394-9ffb-a6fa62269cde)\r\n|","sha":"ac5b14b1254219f79dddd5da0ab9c1ff8d1ea0c1","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement",":ml","Feature:File
and Index Data
Viz","v9.0.0","Team:ML","v8.16.0","backport:version"],"title":"[ML] Data
visualizer: Add icons for semantic text, sparse vector and dense
vector","number":196069,"url":"https://github.com/elastic/kibana/pull/196069","mergeCommit":{"message":"[ML]
Data visualizer: Add icons for semantic text, sparse vector and dense
vector (#196069)\n\n## Summary\r\n\r\nAdded support for `semantic_text`,
`sparse_vector` and `dense_vector` in\r\nthe Data visualizer and Field
Statistics.\r\nFor
[#192161](https://github.com/elastic/kibana/issues/192161)\r\n\r\n\r\n|
Before | After |\r\n| ------------- | -------------
|\r\n|\r\n![image](https://github.com/user-attachments/assets/d87de954-bae0-46d3-9934-e6e6a6424ee0)\r\n|\r\n![image](https://github.com/user-attachments/assets/a6fced39-e227-43ea-9062-9add27aad8fd)\r\n|\r\n|\r\n![image](https://github.com/user-attachments/assets/4c8005e3-439f-4dfc-898b-8158835d803f)\r\n|\r\n![image](https://github.com/user-attachments/assets/a9d501cc-84f9-4394-9ffb-a6fa62269cde)\r\n|","sha":"ac5b14b1254219f79dddd5da0ab9c1ff8d1ea0c1"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/196069","number":196069,"mergeCommit":{"message":"[ML]
Data visualizer: Add icons for semantic text, sparse vector and dense
vector (#196069)\n\n## Summary\r\n\r\nAdded support for `semantic_text`,
`sparse_vector` and `dense_vector` in\r\nthe Data visualizer and Field
Statistics.\r\nFor
[#192161](https://github.com/elastic/kibana/issues/192161)\r\n\r\n\r\n|
Before | After |\r\n| ------------- | -------------
|\r\n|\r\n![image](https://github.com/user-attachments/assets/d87de954-bae0-46d3-9934-e6e6a6424ee0)\r\n|\r\n![image](https://github.com/user-attachments/assets/a6fced39-e227-43ea-9062-9add27aad8fd)\r\n|\r\n|\r\n![image](https://github.com/user-attachments/assets/4c8005e3-439f-4dfc-898b-8158835d803f)\r\n|\r\n![image](https://github.com/user-attachments/assets/a9d501cc-84f9-4394-9ffb-a6fa62269cde)\r\n|","sha":"ac5b14b1254219f79dddd5da0ab9c1ff8d1ea0c1"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Robert Jaszczurek <[email protected]>
  • Loading branch information
kibanamachine and rbrtj authored Oct 15, 2024
1 parent 7245dc5 commit bc3620f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
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',
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

0 comments on commit bc3620f

Please sign in to comment.