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 Frame Analytics creation wizard: ensure preview datagrid displays expected fields #156435

Merged
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { extractErrorMessage } from '@kbn/ml-error-utils';
import { isRuntimeMappings } from '../../../../../../common/util/runtime_field_utils';
import { RuntimeMappings } from '../../../../../../common/types/fields';
import { DEFAULT_SAMPLER_SHARD_SIZE } from '../../../../../../common/constants/field_histograms';
import { newJobCapsServiceAnalytics } from '../../../../services/new_job_capabilities/new_job_capabilities_service_analytics';

import { DataLoader } from '../../../../datavisualizer/index_based/data_loader';

Expand Down Expand Up @@ -60,7 +59,7 @@ function getRuntimeFieldColumns(runtimeMappings: RuntimeMappings) {
}

function getIndexPatternColumns(indexPattern: DataView, fieldsFilter: string[]) {
const { fields } = newJobCapsServiceAnalytics;
const { fields } = indexPattern;

return fields
.filter((field) => fieldsFilter.includes(field.name))
Expand Down Expand Up @@ -117,9 +116,9 @@ export const useIndexData = (

// Get all field names for each returned doc and flatten it
// to a list of unique field names used across all docs.
const allKibanaIndexPatternFields = getFieldsFromKibanaIndexPattern(indexPattern);
const allDataViewFields = getFieldsFromKibanaIndexPattern(indexPattern);
const populatedFields = [...new Set(docs.map(Object.keys).flat(1))]
.filter((d) => allKibanaIndexPatternFields.includes(d))
.filter((d) => allDataViewFields.includes(d))
.sort();

setStatus(INDEX_STATUS.LOADED);
Expand Down