Skip to content

Commit eaffc6b

Browse files
add support for positive_score_impact field to rank_feature
1 parent 6d4e772 commit eaffc6b

4 files changed

Lines changed: 41 additions & 0 deletions

File tree

x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { ObjectType } from './object_type';
2828
import { OtherType } from './other_type';
2929
import { NestedType } from './nested_type';
3030
import { JoinType } from './join_type';
31+
import { RankFeatureType } from './rank_feature_type';
3132

3233
const typeToParametersFormMap: { [key in DataType]?: ComponentType<any> } = {
3334
alias: AliasType,
@@ -52,6 +53,7 @@ const typeToParametersFormMap: { [key in DataType]?: ComponentType<any> } = {
5253
other: OtherType,
5354
nested: NestedType,
5455
join: JoinType,
56+
rank_feature: RankFeatureType,
5557
};
5658

5759
export const getParametersFormForType = (
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
import React from 'react';
7+
import { i18n } from '@kbn/i18n';
8+
9+
import { BasicParametersSection, EditFieldFormRow } from '../edit_field';
10+
11+
export const RankFeatureType = () => {
12+
return (
13+
<BasicParametersSection>
14+
<EditFieldFormRow
15+
title={i18n.translate(
16+
'xpack.idxMgmt.mappingsEditor.rankFeature.positiveScoreImpactFieldTitle',
17+
{
18+
defaultMessage: 'Positive score impact',
19+
}
20+
)}
21+
description={i18n.translate(
22+
'xpack.idxMgmt.mappingsEditor.rankFeature.positiveScoreImpactFieldDescription',
23+
{
24+
defaultMessage:
25+
'Rank features that correlate negatively with the score should disable this field.',
26+
}
27+
)}
28+
formFieldPath="positive_score_impact"
29+
/>
30+
</BasicParametersSection>
31+
);
32+
};

x-pack/plugins/index_management/public/application/components/mappings_editor/constants/parameters_definition.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,12 @@ export const PARAMETERS_DEFINITION: { [key in ParameterName]: ParameterDefinitio
692692
},
693693
schema: t.boolean,
694694
},
695+
positive_score_impact: {
696+
fieldConfig: {
697+
defaultValue: true,
698+
},
699+
schema: t.boolean,
700+
},
695701
preserve_separators: {
696702
fieldConfig: {
697703
defaultValue: true,

x-pack/plugins/index_management/public/application/components/mappings_editor/types/document_fields.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ export type ParameterName =
124124
| 'eager_global_ordinals_join'
125125
| 'index_prefixes'
126126
| 'index_phrases'
127+
| 'positive_score_impact'
127128
| 'norms'
128129
| 'norms_keyword'
129130
| 'term_vector'

0 commit comments

Comments
 (0)