Skip to content

Commit

Permalink
[ML] Data frame analytics: ensure results view loads correctly for jo…
Browse files Browse the repository at this point in the history
…b created in dev tools (#107024)

* check analyzed_fields exists

* update DataFrameAnalyticsConfig type to make analyzed_fields optional

* updating accessing analyzed_fields for type update
  • Loading branch information
alvarezmelissa87 authored Jul 30, 2021
1 parent faed2f6 commit 9dcecae
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions x-pack/plugins/ml/common/types/data_frame_analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ export interface DataFrameAnalyticsConfig {
runtime_mappings?: RuntimeMappings;
};
analysis: AnalysisConfig;
analyzed_fields: {
includes: string[];
excludes: string[];
analyzed_fields?: {
includes?: string[];
excludes?: string[];
};
model_memory_limit: string;
max_num_threads?: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ export const ExplorationPageWrapper: FC<Props> = ({
const resultsField = jobConfig?.dest.results_field ?? '';
const scatterplotFieldOptions = useScatterplotFieldOptions(
indexPattern,
jobConfig?.analyzed_fields.includes,
jobConfig?.analyzed_fields.excludes,
jobConfig?.analyzed_fields?.includes,
jobConfig?.analyzed_fields?.excludes,
resultsField
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ export const OutlierExploration: FC<ExplorationProps> = React.memo(({ jobId }) =

const scatterplotFieldOptions = useScatterplotFieldOptions(
indexPattern,
jobConfig?.analyzed_fields.includes,
jobConfig?.analyzed_fields.excludes,
jobConfig?.analyzed_fields?.includes,
jobConfig?.analyzed_fields?.excludes,
resultsField
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ export async function validateAnalyticsJob(
) {
const messages = await getValidationCheckMessages(
client.asCurrentUser,
job.analyzed_fields.includes,
job?.analyzed_fields?.includes || [],
job.analysis,
job.source
);
Expand Down

0 comments on commit 9dcecae

Please sign in to comment.