Skip to content

Commit

Permalink
[Mappings editor] Add support for positive_score_impact to rank_featu…
Browse files Browse the repository at this point in the history
…re (#76824) (#77335)
  • Loading branch information
alisonelizabeth committed Sep 14, 2020
1 parent b965c21 commit 02dac58
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { ObjectType } from './object_type';
import { OtherType } from './other_type';
import { NestedType } from './nested_type';
import { JoinType } from './join_type';
import { RankFeatureType } from './rank_feature_type';

const typeToParametersFormMap: { [key in DataType]?: ComponentType<any> } = {
alias: AliasType,
Expand All @@ -52,6 +53,7 @@ const typeToParametersFormMap: { [key in DataType]?: ComponentType<any> } = {
other: OtherType,
nested: NestedType,
join: JoinType,
rank_feature: RankFeatureType,
};

export const getParametersFormForType = (
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import React from 'react';
import { i18n } from '@kbn/i18n';

import { BasicParametersSection, EditFieldFormRow } from '../edit_field';

export const RankFeatureType = () => {
return (
<BasicParametersSection>
<EditFieldFormRow
title={i18n.translate(
'xpack.idxMgmt.mappingsEditor.rankFeature.positiveScoreImpactFieldTitle',
{
defaultMessage: 'Positive score impact',
}
)}
description={i18n.translate(
'xpack.idxMgmt.mappingsEditor.rankFeature.positiveScoreImpactFieldDescription',
{
defaultMessage:
'Rank features that correlate negatively with the score should disable this field.',
}
)}
formFieldPath="positive_score_impact"
/>
</BasicParametersSection>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,12 @@ export const PARAMETERS_DEFINITION: { [key in ParameterName]: ParameterDefinitio
},
schema: t.boolean,
},
positive_score_impact: {
fieldConfig: {
defaultValue: true,
},
schema: t.boolean,
},
preserve_separators: {
fieldConfig: {
defaultValue: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export type ParameterName =
| 'eager_global_ordinals_join'
| 'index_prefixes'
| 'index_phrases'
| 'positive_score_impact'
| 'norms'
| 'norms_keyword'
| 'term_vector'
Expand Down

0 comments on commit 02dac58

Please sign in to comment.