Skip to content

Commit 14eefce

Browse files
[ML] Show analysis not available for vector fields in Index Data Visualizer (#209945)
## Summary In 9.0, vector fields like vector embeddings or offsets are no longer exposed in Elasticsearch API, which makes it not possible to sample the count and show examples This PR makes it so that the expanded rows for these fields indicate analysis is not available for these fields. <img width="1295" alt="image" src="https://github.com/user-attachments/assets/60a95883-2918-4af5-821a-8f8a006d8441" /> ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... --------- Co-authored-by: Elastic Machine <[email protected]>
1 parent 8efc247 commit 14eefce

File tree

5 files changed

+56
-2
lines changed

5 files changed

+56
-2
lines changed

x-pack/platform/plugins/private/data_visualizer/public/application/common/components/expanded_row/index_based_expanded_row.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import type { FieldVisConfig } from '../stats_table/types';
2424
import type { CombinedQuery } from '../../../index_data_visualizer/types/combined_query';
2525
import { LoadingIndicator } from '../loading_indicator';
2626
import { ErrorMessageContent } from '../stats_table/components/field_data_expanded_row/error_message';
27+
import { NotSupportedContent } from '../not_in_docs_content/not_supported_content';
2728

2829
export const IndexBasedDataVisualizerExpandedRow = ({
2930
item,
@@ -55,6 +56,10 @@ export const IndexBasedDataVisualizerExpandedRow = ({
5556
const dvExpandedRow = useExpandedRowCss();
5657

5758
function getCardContent() {
59+
if (type === 'unknown' || type.includes('vector') || item.secondaryType?.includes('vector')) {
60+
return <NotSupportedContent />;
61+
}
62+
5863
if (existsInDocs === false) {
5964
return <NotInDocsContent />;
6065
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
import React, { Fragment } from 'react';
8+
import { FormattedMessage } from '@kbn/i18n-react';
9+
import { EuiIcon, EuiText } from '@elastic/eui';
10+
import type { FC } from 'react';
11+
12+
export const NotSupportedContent: FC = () => (
13+
<Fragment>
14+
<EuiText textAlign="center">
15+
<EuiIcon type="warning" />
16+
</EuiText>
17+
<EuiText textAlign="center" size={'xs'}>
18+
<FormattedMessage
19+
id="xpack.dataVisualizer.dataGrid.field.analysisNotSupportedLabel"
20+
defaultMessage="Analysis is not available for this field."
21+
/>
22+
</EuiText>
23+
</Fragment>
24+
);

x-pack/platform/plugins/private/data_visualizer/public/application/index_data_visualizer/embeddables/grid_embeddable/embeddable_field_stats_table.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,13 @@ const EmbeddableFieldStatsTableWrapper = (
4444
searchString,
4545
extendedColumns,
4646
progress,
47+
overallStats,
4748
overallStatsProgress,
4849
setLastRefresh,
4950
} = useDataVisualizerGridData(props, dataVisualizerListState);
5051

52+
const totalCount = overallStats?.totalCount;
53+
5154
useEffect(() => {
5255
setLastRefresh(Date.now());
5356
}, [props?.lastReloadRequestTime, setLastRefresh]);
@@ -93,6 +96,7 @@ const EmbeddableFieldStatsTableWrapper = (
9396
onChange={onTableUpdate}
9497
loading={progress < 100}
9598
overallStatsRunning={overallStatsProgress.isRunning}
99+
totalCount={totalCount}
96100
renderFieldName={props.renderFieldName}
97101
/>
98102
);

x-pack/platform/plugins/private/data_visualizer/public/application/index_data_visualizer/hooks/use_overall_stats.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import {
3131
isAggregatableFieldOverallStats,
3232
isNonAggregatableFieldOverallStats,
3333
isNonAggregatableSampledDocs,
34+
isUnsupportedVectorField,
3435
processAggregatableFieldsExistResponse,
3536
processNonAggregatableFieldsExistResponse,
3637
} from '../search_strategy/requests/overall_stats';
@@ -214,6 +215,9 @@ export function useOverallStats<TParams extends OverallStatsSearchStrategyParams
214215
const nonAggregatableFields = hasPopulatedFieldsInfo
215216
? originalNonAggregatableFields.filter((fieldName) => populatedFieldsInIndex.has(fieldName))
216217
: originalNonAggregatableFields;
218+
const supportedNonAggregatableFields = nonAggregatableFields.filter((fieldName) => {
219+
return !isUnsupportedVectorField(fieldName);
220+
});
217221

218222
const documentCountStats = await getDocumentCountStats(
219223
data.search,
@@ -227,7 +231,7 @@ export function useOverallStats<TParams extends OverallStatsSearchStrategyParams
227231
.search<IKibanaSearchRequest, IKibanaSearchResponse>(
228232
{
229233
params: getSampleOfDocumentsForNonAggregatableFields(
230-
nonAggregatableFields,
234+
supportedNonAggregatableFields,
231235
index,
232236
searchQuery,
233237
timeFieldName,
@@ -244,7 +248,7 @@ export function useOverallStats<TParams extends OverallStatsSearchStrategyParams
244248
})
245249
);
246250

247-
const nonAggregatableFieldsObs = nonAggregatableFields.map((fieldName: string) =>
251+
const nonAggregatableFieldsObs = supportedNonAggregatableFields.map((fieldName: string) =>
248252
data.search
249253
.search<IKibanaSearchRequest, IKibanaSearchResponse>(
250254
{

x-pack/platform/plugins/private/data_visualizer/public/application/index_data_visualizer/search_strategy/requests/overall_stats.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,10 @@ export const checkNonAggregatableFieldExistsRequest = (
252252

253253
const DEFAULT_DOCS_SAMPLE_OF_TEXT_FIELDS_SIZE = 1000;
254254

255+
export const isUnsupportedVectorField = (fieldName: string) => {
256+
return fieldName.endsWith('.chunks.embeddings') || fieldName.endsWith('.chunks.offset');
257+
};
258+
255259
export const getSampleOfDocumentsForNonAggregatableFields = (
256260
nonAggregatableFields: string[],
257261
dataViewTitle: string,
@@ -305,6 +309,19 @@ export const processNonAggregatableFieldsExistResponse = (
305309
});
306310
return;
307311
}
312+
if (isUnsupportedVectorField(fieldName)) {
313+
stats.nonAggregatableExistsFields.push({
314+
fieldName,
315+
existsInDocs: true,
316+
stats: {
317+
count: undefined,
318+
cardinality: undefined,
319+
sampleCount: undefined,
320+
},
321+
});
322+
return;
323+
}
324+
308325
const foundField = results.find((r) => r.rawResponse.fieldName === fieldName);
309326
const existsInDocs = foundField !== undefined && foundField.rawResponse.hits.total > 0;
310327

0 commit comments

Comments
 (0)