From b135c3b5f22a6ffe4777c0d4c3ef9726e14d8ef0 Mon Sep 17 00:00:00 2001
From: Alison Goryachev
Date: Wed, 2 Sep 2020 16:50:19 -0400
Subject: [PATCH 1/3] add support for wildcard field type
---
.../ignore_above_parameter.tsx | 39 +++++++++++++++++++
.../document_fields/field_parameters/index.ts | 2 +
.../fields/field_types/flattened_type.tsx | 25 ++----------
.../fields/field_types/index.ts | 2 +
.../fields/field_types/keyword_type.tsx | 21 ++--------
.../fields/field_types/wildcard_type.tsx | 30 ++++++++++++++
.../constants/data_types_definition.tsx | 18 +++++++++
.../mappings_editor/types/document_fields.ts | 1 +
8 files changed, 99 insertions(+), 39 deletions(-)
create mode 100644 x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/ignore_above_parameter.tsx
create mode 100644 x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/wildcard_type.tsx
diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/ignore_above_parameter.tsx b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/ignore_above_parameter.tsx
new file mode 100644
index 0000000000000..48a8e42f5065d
--- /dev/null
+++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/ignore_above_parameter.tsx
@@ -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 = ({ defaultToggleValue }) => (
+
+
+
+);
diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/index.ts b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/index.ts
index 805a6b6ece705..a2d5c7c8d5308 100644
--- a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/index.ts
+++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/index.ts
@@ -69,6 +69,8 @@ export * from './other_type_name_parameter';
export * from './other_type_json_parameter';
+export * from './ignore_above_parameter';
+
export const PARAMETER_SERIALIZERS = [relationsSerializer, dynamicSerializer];
export const PARAMETER_DESERIALIZERS = [relationsDeserializer, dynamicDeserializer];
diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/flattened_type.tsx b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/flattened_type.tsx
index 7c8ac86f14153..86bd599ba25ee 100644
--- a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/flattened_type.tsx
+++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/flattened_type.tsx
@@ -19,6 +19,7 @@ import {
NullValueParameter,
SimilarityParameter,
SplitQueriesOnWhitespaceParameter,
+ IgnoreAboveParameter,
} from '../../field_parameters';
import { BasicParametersSection, EditFieldFormRow, AdvancedParametersSection } from '../edit_field';
@@ -29,6 +30,7 @@ interface Props {
const getDefaultToggleValue = (param: string, field: FieldType) => {
switch (param) {
case 'boost':
+ case 'ignore_above':
case 'similarity': {
return field[param] !== undefined && field[param] !== getFieldConfig(param).defaultValue;
}
@@ -66,28 +68,9 @@ export const FlattenedType = React.memo(({ field }: Props) => {
- {/* ignore_above */}
-
-
-
+ />
diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/index.ts b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/index.ts
index 20623b9d7e62b..9b4bfd1ee2fb0 100644
--- a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/index.ts
+++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/index.ts
@@ -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 { WildcardType } from './wildcard_type';
const typeToParametersFormMap: { [key in DataType]?: ComponentType } = {
alias: AliasType,
@@ -52,6 +53,7 @@ const typeToParametersFormMap: { [key in DataType]?: ComponentType } = {
other: OtherType,
nested: NestedType,
join: JoinType,
+ wildcard: WildcardType,
};
export const getParametersFormForType = (
diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/keyword_type.tsx b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/keyword_type.tsx
index 43377357f1e6f..dc4f4b3ba5ff1 100644
--- a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/keyword_type.tsx
+++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/keyword_type.tsx
@@ -23,6 +23,7 @@ import {
SimilarityParameter,
CopyToParameter,
SplitQueriesOnWhitespaceParameter,
+ IgnoreAboveParameter,
} from '../../field_parameters';
import { BasicParametersSection, EditFieldFormRow, AdvancedParametersSection } from '../edit_field';
@@ -79,25 +80,9 @@ export const KeywordType = ({ field }: Props) => {
- {/* ignore_above */}
-
-
-
+ />
diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/wildcard_type.tsx b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/wildcard_type.tsx
new file mode 100644
index 0000000000000..2f61ab8c7ab1b
--- /dev/null
+++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/wildcard_type.tsx
@@ -0,0 +1,30 @@
+/*
+ * 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 { UseField, Field } from '../../../../shared_imports';
+import { NormalizedField } from '../../../../types';
+import { getFieldConfig } from '../../../../lib';
+import { IgnoreAboveParameter } from '../../field_parameters';
+import { AdvancedParametersSection, EditFieldFormRow } from '../edit_field';
+
+interface Props {
+ field: NormalizedField;
+}
+
+const getDefaultToggleValue = (param: string, field: FieldType) => {
+ return field[param] !== undefined && field[param] !== getFieldConfig(param).defaultValue;
+};
+
+export const WildcardType = ({ field }: Props) => {
+ return (
+
+
+
+ );
+};
diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/constants/data_types_definition.tsx b/x-pack/plugins/index_management/public/application/components/mappings_editor/constants/data_types_definition.tsx
index edfb6903a8585..a8844c7a9b270 100644
--- a/x-pack/plugins/index_management/public/application/components/mappings_editor/constants/data_types_definition.tsx
+++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/constants/data_types_definition.tsx
@@ -784,6 +784,23 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
),
},
+ wildcard: {
+ label: i18n.translate('xpack.idxMgmt.mappingsEditor.dataType.wildcardDescription', {
+ defaultMessage: 'Wildcard',
+ }),
+ value: 'wildcard',
+ documentation: {
+ main: '/keyword.html#wildcard-field-type',
+ },
+ description: () => (
+
+
+
+ ),
+ },
other: {
label: i18n.translate('xpack.idxMgmt.mappingsEditor.dataType.otherDescription', {
defaultMessage: 'Other',
@@ -825,6 +842,7 @@ export const MAIN_TYPES: MainType[] = [
'shape',
'text',
'token_count',
+ 'wildcard',
'other',
];
diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/types/document_fields.ts b/x-pack/plugins/index_management/public/application/components/mappings_editor/types/document_fields.ts
index a9f6d2ea03bdf..9b494aee94ee1 100644
--- a/x-pack/plugins/index_management/public/application/components/mappings_editor/types/document_fields.ts
+++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/types/document_fields.ts
@@ -59,6 +59,7 @@ export type MainType =
| 'geo_point'
| 'geo_shape'
| 'token_count'
+ | 'wildcard'
/**
* 'other' is a special type that only exists inside of MappingsEditor as a placeholder
* for undocumented field types.
From eae5620007e01dbd6319e9f5022a0197a4de9701 Mon Sep 17 00:00:00 2001
From: Alison Goryachev
Date: Wed, 2 Sep 2020 20:56:27 -0400
Subject: [PATCH 2/3] fix TS
---
.../document_fields/fields/field_types/flattened_type.tsx | 1 -
.../document_fields/fields/field_types/wildcard_type.tsx | 7 +++----
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/flattened_type.tsx b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/flattened_type.tsx
index 86bd599ba25ee..e96426ece27e8 100644
--- a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/flattened_type.tsx
+++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/flattened_type.tsx
@@ -6,7 +6,6 @@
import React from 'react';
import { i18n } from '@kbn/i18n';
-import { documentationService } from '../../../../../../services/documentation';
import { NormalizedField, Field as FieldType } from '../../../../types';
import { UseField, Field } from '../../../../shared_imports';
import { getFieldConfig } from '../../../../lib';
diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/wildcard_type.tsx b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/wildcard_type.tsx
index 2f61ab8c7ab1b..825b9e17c8d2c 100644
--- a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/wildcard_type.tsx
+++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/wildcard_type.tsx
@@ -5,17 +5,16 @@
*/
import React from 'react';
-import { UseField, Field } from '../../../../shared_imports';
-import { NormalizedField } from '../../../../types';
+import { NormalizedField, Field as FieldType, ParameterName } from '../../../../types';
import { getFieldConfig } from '../../../../lib';
import { IgnoreAboveParameter } from '../../field_parameters';
-import { AdvancedParametersSection, EditFieldFormRow } from '../edit_field';
+import { AdvancedParametersSection } from '../edit_field';
interface Props {
field: NormalizedField;
}
-const getDefaultToggleValue = (param: string, field: FieldType) => {
+const getDefaultToggleValue = (param: ParameterName, field: FieldType) => {
return field[param] !== undefined && field[param] !== getFieldConfig(param).defaultValue;
};
From 3b354978e0eef886fc2225280dc2a4a86cb5aa9c Mon Sep 17 00:00:00 2001
From: Alison Goryachev
Date: Wed, 2 Sep 2020 21:19:18 -0400
Subject: [PATCH 3/3] remove unused translations
---
x-pack/plugins/translations/translations/ja-JP.json | 5 -----
x-pack/plugins/translations/translations/zh-CN.json | 5 -----
2 files changed, 10 deletions(-)
diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json
index 59d952d08c181..3455fd958d717 100644
--- a/x-pack/plugins/translations/translations/ja-JP.json
+++ b/x-pack/plugins/translations/translations/ja-JP.json
@@ -7618,7 +7618,6 @@
"xpack.idxMgmt.mappingsEditor.fielddata.frequencyFilterPercentageFieldLabel": "パーセンテージベースの頻度範囲",
"xpack.idxMgmt.mappingsEditor.fielddata.useAbsoluteValuesFieldLabel": "絶対値の使用",
"xpack.idxMgmt.mappingsEditor.fieldsTabLabel": "マッピングされたフィールド",
- "xpack.idxMgmt.mappingsEditor.flattened.ignoreAboveDocLinkText": "上記ドキュメントの無視",
"xpack.idxMgmt.mappingsEditor.formatDocLinkText": "フォーマットのドキュメンテーション",
"xpack.idxMgmt.mappingsEditor.formatFieldLabel": "フォーマット",
"xpack.idxMgmt.mappingsEditor.formatHelpText": "{dateSyntax}構文を使用し、カスタムフォーマットを指定します。",
@@ -7749,10 +7748,6 @@
"xpack.idxMgmt.mappingsEditor.joinType.relationshipTable.parentFieldAriaLabel": "親フィールド",
"xpack.idxMgmt.mappingsEditor.joinType.relationshipTable.removeRelationshipTooltipLabel": "関係を削除",
"xpack.idxMgmt.mappingsEditor.largestShingleSizeFieldLabel": "最大シングルサイズ",
- "xpack.idxMgmt.mappingsEditor.leafLengthLimitFieldDescription": "特定の長さ以上のリーフ値のインデックスを無効化。これは、Luceneの文字制限(8,191 UTF-8 文字)に対する保護に役立ちます。",
- "xpack.idxMgmt.mappingsEditor.leafLengthLimitFieldTitle": "長さ制限の設定",
- "xpack.idxMgmt.mappingsEditor.lengthLimitFieldDescription": "この値よりも長い文字列はインデックスされません。これは、Luceneの文字制限(8,191 UTF-8 文字)に対する保護に役立ちます。",
- "xpack.idxMgmt.mappingsEditor.lengthLimitFieldTitle": "長さ制限の設定",
"xpack.idxMgmt.mappingsEditor.loadFromJsonButtonLabel": "JSONの読み込み",
"xpack.idxMgmt.mappingsEditor.loadJsonModal.acceptWarningLabel": "読み込みの続行",
"xpack.idxMgmt.mappingsEditor.loadJsonModal.cancelButtonLabel": "キャンセル",
diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json
index 6641eede91e66..f3f6010eec94c 100644
--- a/x-pack/plugins/translations/translations/zh-CN.json
+++ b/x-pack/plugins/translations/translations/zh-CN.json
@@ -7620,7 +7620,6 @@
"xpack.idxMgmt.mappingsEditor.fielddata.frequencyFilterPercentageFieldLabel": "基于百分比的频率范围",
"xpack.idxMgmt.mappingsEditor.fielddata.useAbsoluteValuesFieldLabel": "使用绝对值",
"xpack.idxMgmt.mappingsEditor.fieldsTabLabel": "已映射字段",
- "xpack.idxMgmt.mappingsEditor.flattened.ignoreAboveDocLinkText": "“忽略上述”文档",
"xpack.idxMgmt.mappingsEditor.formatDocLinkText": "“格式”文档",
"xpack.idxMgmt.mappingsEditor.formatFieldLabel": "格式",
"xpack.idxMgmt.mappingsEditor.formatHelpText": "使用 {dateSyntax} 语法指定定制格式。",
@@ -7751,10 +7750,6 @@
"xpack.idxMgmt.mappingsEditor.joinType.relationshipTable.parentFieldAriaLabel": "父项字段",
"xpack.idxMgmt.mappingsEditor.joinType.relationshipTable.removeRelationshipTooltipLabel": "移除关系",
"xpack.idxMgmt.mappingsEditor.largestShingleSizeFieldLabel": "最大瓦形大小",
- "xpack.idxMgmt.mappingsEditor.leafLengthLimitFieldDescription": "如果叶值超过一定长度,则阻止叶值索引。这用于防止超出 Lucene 的字词字符长度限制,即 8,191 个 UTF-8 字符。",
- "xpack.idxMgmt.mappingsEditor.leafLengthLimitFieldTitle": "设置长度限制",
- "xpack.idxMgmt.mappingsEditor.lengthLimitFieldDescription": "将不索引超过此值的字符串。这用于防止超出 Lucene 的字词字符长度限制,即 8,191 个 UTF-8 字符。",
- "xpack.idxMgmt.mappingsEditor.lengthLimitFieldTitle": "设置长度限制",
"xpack.idxMgmt.mappingsEditor.loadFromJsonButtonLabel": "加载 JSON",
"xpack.idxMgmt.mappingsEditor.loadJsonModal.acceptWarningLabel": "继续加载",
"xpack.idxMgmt.mappingsEditor.loadJsonModal.cancelButtonLabel": "取消",