Skip to content

Commit

Permalink
add keyword suffix if field type is keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarezmelissa87 committed Jan 7, 2020
1 parent 6c6689c commit 1b12463
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ import { newJobCapsService } from '../../../../../services/new_job_capabilities_
import { getIndexPatternIdFromName } from '../../../../../util/index_utils';

const defaultPanelWidth = 500;
const NO_KEYWORD_FIELDTYPES = [ES_FIELD_TYPES.BOOLEAN, ES_FIELD_TYPES.INTEGER];

interface Props {
jobConfig: DataFrameAnalyticsConfig;
Expand Down Expand Up @@ -73,7 +72,7 @@ export const EvaluatePanel: FC<Props> = ({ jobConfig, jobStatus, searchQuery })
const predictionFieldName = getPredictionFieldName(jobConfig.analysis);
// default is 'ml'
const resultsField = jobConfig.dest.results_field;
let noKeywordRequired = false;
let requiresKeyword = false;

const loadData = async ({
isTrainingClause,
Expand All @@ -95,7 +94,7 @@ export const EvaluatePanel: FC<Props> = ({ jobConfig, jobStatus, searchQuery })
const depVarFieldType = fields.find(field => field.name === dependentVariable)?.type;

if (depVarFieldType !== undefined) {
noKeywordRequired = NO_KEYWORD_FIELDTYPES.includes(depVarFieldType);
requiresKeyword = depVarFieldType === ES_FIELD_TYPES.KEYWORD;
}
}
} catch (e) {
Expand All @@ -112,7 +111,7 @@ export const EvaluatePanel: FC<Props> = ({ jobConfig, jobStatus, searchQuery })
searchQuery,
ignoreDefaultQuery,
jobType: ANALYSIS_CONFIG_TYPE.CLASSIFICATION,
requiresKeyword: noKeywordRequired === false,
requiresKeyword,
});

const docsCountResp = await loadDocsCount({
Expand Down

0 comments on commit 1b12463

Please sign in to comment.