forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Mappings editor] Add support for wildcard field type (elastic#76574) (…
- Loading branch information
1 parent
af807ac
commit 1a8b805
Showing
10 changed files
with
98 additions
and
50 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
...ts/mappings_editor/components/document_fields/field_parameters/ignore_above_parameter.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* 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, { FunctionComponent } from 'react'; | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
|
||
import { documentationService } from '../../../../../services/documentation'; | ||
import { getFieldConfig } from '../../../lib'; | ||
import { UseField, Field } from '../../../shared_imports'; | ||
import { EditFieldFormRow } from '../fields/edit_field'; | ||
|
||
interface Props { | ||
defaultToggleValue: boolean; | ||
} | ||
|
||
export const IgnoreAboveParameter: FunctionComponent<Props> = ({ defaultToggleValue }) => ( | ||
<EditFieldFormRow | ||
title={i18n.translate('xpack.idxMgmt.mappingsEditor.ignoreAboveFieldTitle', { | ||
defaultMessage: 'Set length limit', | ||
})} | ||
description={i18n.translate('xpack.idxMgmt.mappingsEditor.ignoreAboveFieldDescription', { | ||
defaultMessage: | ||
'Strings longer than this value will not be indexed. This is useful for protecting against Lucene’s term character-length limit of 8,191 UTF-8 characters.', | ||
})} | ||
docLink={{ | ||
text: i18n.translate('xpack.idxMgmt.mappingsEditor.ignoreAboveDocLinkText', { | ||
defaultMessage: 'Ignore above documentation', | ||
}), | ||
href: documentationService.getIgnoreAboveLink(), | ||
}} | ||
defaultToggleValue={defaultToggleValue} | ||
> | ||
<UseField path="ignore_above" config={getFieldConfig('ignore_above')} component={Field} /> | ||
</EditFieldFormRow> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...omponents/mappings_editor/components/document_fields/fields/field_types/wildcard_type.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* 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 { NormalizedField, Field as FieldType, ParameterName } from '../../../../types'; | ||
import { getFieldConfig } from '../../../../lib'; | ||
import { IgnoreAboveParameter } from '../../field_parameters'; | ||
import { AdvancedParametersSection } from '../edit_field'; | ||
|
||
interface Props { | ||
field: NormalizedField; | ||
} | ||
|
||
const getDefaultToggleValue = (param: ParameterName, field: FieldType) => { | ||
return field[param] !== undefined && field[param] !== getFieldConfig(param).defaultValue; | ||
}; | ||
|
||
export const WildcardType = ({ field }: Props) => { | ||
return ( | ||
<AdvancedParametersSection> | ||
<IgnoreAboveParameter | ||
defaultToggleValue={getDefaultToggleValue('ignore_above', field.source)} | ||
/> | ||
</AdvancedParametersSection> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters