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

[Mappings editor] Add support for positive_score_impact field to rank_feature #76824

Merged
Show file tree
Hide file tree
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 @@ -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