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

[Data Views] Disable scripted field creation in the Data Views management page #202250

Merged
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
1af7942
disable scripted field creation
mattkime Aug 15, 2024
5bb4dce
Merge branch 'main' into disable_scripted_field_creation
mattkime Sep 17, 2024
bb2ac7d
remove button, add callout, update functional tests
mattkime Sep 18, 2024
c396745
remove unused localization
mattkime Sep 18, 2024
3f3dfe8
test fixes
mattkime Sep 18, 2024
9b56eff
test fixes
mattkime Sep 18, 2024
4de4413
fix functional tests and Ãsnapshöts
mattkime Sep 18, 2024
aa5130e
add i18n
mattkime Sep 18, 2024
b5dac4d
better fallback when scripted field tab isn't available - for functio…
mattkime Sep 18, 2024
65ac465
more functional test fixes
mattkime Sep 18, 2024
4647a32
fix functional test
mattkime Sep 18, 2024
b308106
remove period from title
mattkime Sep 20, 2024
909d9c3
update snapshot
mattkime Sep 20, 2024
c3bdd04
Merge branch 'main' into disable_scripted_field_creation
mattkime Sep 28, 2024
d3ad3cf
Merge branch 'main' into davis_disable_scripted_field_creation
davismcphee Nov 29, 2024
6ee7c25
Update docs and UA copy
davismcphee Nov 29, 2024
33d3d19
Copy fixes
davismcphee Nov 29, 2024
5037ad5
Remove modified translations
davismcphee Nov 29, 2024
6b44a98
Add markdown support to ugprade assistant and updated scripted fields…
davismcphee Dec 1, 2024
662f41b
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine Dec 1, 2024
0c06115
Adjust copy
davismcphee Dec 2, 2024
b66b159
Merge branch 'main' into davis_disable_scripted_field_creation
davismcphee Dec 3, 2024
c937a94
Update docs
davismcphee Dec 3, 2024
9030958
Fix broken test
davismcphee Dec 3, 2024
7b0984c
Add upgrade notes
davismcphee Dec 3, 2024
c0b7021
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine Dec 3, 2024
9e258da
Cleanup
davismcphee Dec 3, 2024
367119a
Merge branch 'main' into davis_disable_scripted_field_creation
davismcphee Dec 3, 2024
0ab2795
Show data view name when available in UA
davismcphee Dec 4, 2024
1c10e2f
Merge branch 'main' into davis_disable_scripted_field_creation
davismcphee Dec 5, 2024
8334e46
Apply docs PR feedback
davismcphee Dec 5, 2024
cf2ff64
Merge branch 'main' into davis_disable_scripted_field_creation
davismcphee Dec 5, 2024
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
Prev Previous commit
Next Next commit
Cleanup
  • Loading branch information
davismcphee committed Dec 3, 2024
commit 9e258daa5cb68c5c3859b03940ff10d9e4177b12
2 changes: 1 addition & 1 deletion docs/management/manage-data-views.asciidoc
Original file line number Diff line number Diff line change
@@ -170,7 +170,7 @@ Edit the settings for runtime fields, or remove runtime fields from data views.
[[scripted-fields]]
=== Add scripted fields to data views

deprecated::[7.13,Use {ref}/runtime.html[runtime fields] instead of scripted fields. Runtime fields support Painless scripts and provide greater flexibility. You can also use the {ref}/esql.html[Elasticsearch Query Language (ES|QL)] to compute values directly at query time.]
deprecated::[7.13,Use {ref}/runtime.html[runtime fields] instead of scripted fields. Runtime fields support Painless scripting and provide greater flexibility. You can also use the {ref}/esql.html[Elasticsearch Query Language (ES|QL)] to compute values directly at query time.]

Scripted fields compute data on the fly from the data in your {es} indices. The data is shown on
the Discover tab as part of the document data, and you can use scripted fields in your visualizations. You query scripted fields with the <<kuery-query, {kib} query language>>, and can filter them using the filter bar. The scripted field values are computed at query time, so they aren't indexed and cannot be searched using the {kib} default
4 changes: 1 addition & 3 deletions packages/kbn-doc-links/src/get_doc_links.ts
Original file line number Diff line number Diff line change
@@ -97,9 +97,6 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
urlDrilldownTemplateSyntax: `${KIBANA_DOCS}drilldowns.html#url-templating-language`,
urlDrilldownVariables: `${KIBANA_DOCS}drilldowns.html#url-template-variable`,
},
dataViews: {
migrateOffScriptedFields: `${KIBANA_DOCS}managing-data-views.html#migrate-off-scripted-fields`,
},
discover: {
guide: `${KIBANA_DOCS}discover.html`,
fieldStatistics: `${KIBANA_DOCS}show-field-statistics.html`,
@@ -348,6 +345,7 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
fieldFormattersNumber: `${KIBANA_DOCS}numeral.html`,
fieldFormattersString: `${KIBANA_DOCS}managing-data-views.html#string-field-formatters`,
runtimeFields: `${KIBANA_DOCS}managing-data-views.html#runtime-fields`,
migrateOffScriptedFields: `${KIBANA_DOCS}managing-data-views.html#migrate-off-scripted-fields`,
},
addData: `${KIBANA_DOCS}connect-to-elasticsearch.html`,
kibana: {
4 changes: 1 addition & 3 deletions packages/kbn-doc-links/src/types.ts
Original file line number Diff line number Diff line change
@@ -63,9 +63,6 @@ export interface DocLinks {
readonly urlDrilldownTemplateSyntax: string;
readonly urlDrilldownVariables: string;
};
readonly dataViews: {
readonly migrateOffScriptedFields: string;
};
readonly discover: Record<string, string>;
readonly filebeat: {
readonly base: string;
@@ -307,6 +304,7 @@ export interface DocLinks {
readonly fieldFormattersNumber: string;
readonly fieldFormattersString: string;
readonly runtimeFields: string;
readonly migrateOffScriptedFields: string;
};
readonly addData: string;
readonly kibana: {

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -24,11 +24,12 @@ export const CallOuts = ({ deprecatedLangsInUse, painlessDocLink }: CallOutsProp

return (
<>
<EuiSpacer size="m" />
<EuiCallOut
title={
<FormattedMessage
id="indexPatternManagement.editIndexPattern.scripted.deprecationLangHeader"
defaultMessage="Deprecation languages in use"
id="indexPatternManagement.editIndexPattern.scripted.deprecatedLangHeader"
defaultMessage="Deprecated languages in use"
/>
}
color="danger"
@@ -38,7 +39,7 @@ export const CallOuts = ({ deprecatedLangsInUse, painlessDocLink }: CallOutsProp
<FormattedMessage
id="indexPatternManagement.editIndexPattern.scripted.deprecationLangLabel.deprecationLangDetail"
defaultMessage="The following deprecated languages are in use: {deprecatedLangsInUse}. Support for these languages will be
removed in the next major version of Kibana and Elasticsearch. Convert you scripted fields to {link} to avoid any problems."
removed in the next major version of Kibana and Elasticsearch. Convert your scripted fields to {link} to avoid any problems."
values={{
deprecatedLangsInUse: deprecatedLangsInUse.join(', '),
link: (
@@ -53,7 +54,6 @@ export const CallOuts = ({ deprecatedLangsInUse, painlessDocLink }: CallOutsProp
/>
</p>
</EuiCallOut>
<EuiSpacer size="m" />
</>
);
};

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
*/

import React from 'react';
import { EuiCallOut, EuiFlexGroup, EuiFlexItem, EuiText, EuiLink } from '@elastic/eui';
import { EuiCallOut, EuiFlexGroup, EuiFlexItem, EuiText, EuiLink, EuiSpacer } from '@elastic/eui';

import { FormattedMessage } from '@kbn/i18n-react';
import { i18n } from '@kbn/i18n';
@@ -32,20 +32,28 @@ export const Header = () => {
<FormattedMessage
id="indexPatternManagement.editIndexPattern.deprecation.message"
tagName="span"
defaultMessage="Use {runtimeDocs} instead."
defaultMessage="Use {runtimeFieldsLink} instead of scripted fields. Runtime fields support Painless scripting and provide greater flexibility. You can also use the {esqlLink} to compute values directly at query time."
values={{
runtimeDocs: (
runtimeFieldsLink: (
<EuiLink target="_blank" href={links.indexPatterns.runtimeFields}>
<FormattedMessage
id="indexPatternManagement.header.runtimeLink"
defaultMessage="runtime fields"
/>
</EuiLink>
),
esqlLink: (
<EuiLink target="_blank" href={links.query.queryESQL}>
<FormattedMessage
id="indexPatternManagement.header.esqlLink"
defaultMessage="Elasticsearch Query Language (ES|QL)"
/>
</EuiLink>
),
}}
/>
</EuiCallOut>
<br />
<EuiSpacer size="m" />
<EuiText size="s">
<p>
<FormattedMessage
Original file line number Diff line number Diff line change
@@ -59,15 +59,15 @@ export class ScriptedFieldsTable extends Component<
}

fetchFields = async () => {
const fields = await (this.props.indexPattern.getScriptedFields() as ScriptedFieldItem[]);
const fields = this.props.indexPattern.getScriptedFields() as ScriptedFieldItem[];

const deprecatedLangsInUse = [];
const deprecatedLangs = getDeprecatedScriptingLanguages();
const supportedLangs = getSupportedScriptingLanguages();

for (const field of fields) {
const lang = field.lang;
if (deprecatedLangs.includes(lang) || !supportedLangs.includes(lang)) {
if (lang && (deprecatedLangs.includes(lang) || !supportedLangs.includes(lang))) {
deprecatedLangsInUse.push(lang);
}
}
1 change: 1 addition & 0 deletions src/plugins/data_view_management/public/mocks.ts
Original file line number Diff line number Diff line change
@@ -57,6 +57,7 @@ const docLinks = {
indexPatterns: {},
scriptedFields: {},
runtimeFields: {},
query: {},
} as any,
};

4 changes: 2 additions & 2 deletions src/plugins/data_views/server/deprecations/scripted_fields.ts
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ export const createScriptedFieldsDeprecationsConfig: (
dataViewsWithScriptedFields,
docLinks: core.docLinks.links,
}),
documentationUrl: core.docLinks.links.dataViews.migrateOffScriptedFields,
documentationUrl: core.docLinks.links.indexPatterns.migrateOffScriptedFields,
deprecationType: 'feature',
level: 'warning', // warning because it is not set in stone WHEN we remove scripted fields, hence this deprecation is not a blocker for 9.0 upgrade
correctiveActions: {
@@ -133,7 +133,7 @@ The following is a list of all data views with scripted fields and their associa
{dataViewsList}`,
values: {
numberOfDataViewsWithScriptedFields: dataViewsWithScriptedFields.length,
runtimeFieldsLink: docLinks.runtimeFields.overview,
runtimeFieldsLink: docLinks.indexPatterns.runtimeFields,
esqlLink: docLinks.query.queryESQL,
dataViewsList: dataViewsWithScriptedFields.map(buildDataViewsListEntry).join('\n'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great, tested and works as expected, no scripted fields in a data view, no tab, just the manual way using the old URL to create a scripted field, which then shows the tab with scripted fields, and no button 🥳

One question, about the deprecation message, previously we showed just a max of 3 data views, but it seems we show them all now? or do I miss something. ... just for the case when there are many data views with scripted fields

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We used to only show up to three titles in the message, but included the full list in the corrective actions:

i18n.translate('dataViews.deprecations.scriptedFields.manualStepTwoMessage', {
defaultMessage:
'Update {numberOfIndexPatternsWithScriptedFields} data views that have scripted fields to use runtime fields instead. In most cases, to migrate existing scripts, you will need to change "return <value>;" to "emit(<value>);". Data views with at least one scripted field: {allTitles}',
values: {
allTitles: indexPatternTitles.join('; '),
numberOfIndexPatternsWithScriptedFields: indexPatternsWithScriptedFields.length,
},
ignoreTag: true,
}),

I removed the ones from correctiveActions and instead put a formatted list in the main message. This could get really long for customers who have many data views with scripted fields, but the alternative is not having access to a full list, so I'm not sure what else we could do here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that's how it works, thx, what else we can do? Nothing. Approving 👍

},
2 changes: 0 additions & 2 deletions x-pack/plugins/translations/translations/fr-FR.json
Original file line number Diff line number Diff line change
@@ -5338,8 +5338,6 @@
"indexPatternManagement.editIndexPattern.scripted.deleteField.cancelButton": "Annuler",
"indexPatternManagement.editIndexPattern.scripted.deleteField.deleteButton": "Supprimer",
"indexPatternManagement.editIndexPattern.scripted.deleteFieldLabel": "Supprimer le champ scripté \"{fieldName}\" ?",
"indexPatternManagement.editIndexPattern.scripted.deprecationLangHeader": "Langages déclassés en cours d'utilisation",
"indexPatternManagement.editIndexPattern.scripted.deprecationLangLabel.deprecationLangDetail": "Les langages déclassés suivants sont en cours d'utilisation : {deprecatedLangsInUse}. La prise en charge de ces langages sera supprimée dans la prochaine version majeure de Kibana et d'Elasticsearch. Convertissez vos champs scriptés en {link} pour éviter tout problème.",
"indexPatternManagement.editIndexPattern.scripted.deprecationLangLabel.painlessDescription": "Painless",
"indexPatternManagement.editIndexPattern.scripted.newFieldPlaceholder": "Nouveau champ scripté",
"indexPatternManagement.editIndexPattern.scripted.table.deleteDescription": "Supprimer ce champ",
2 changes: 0 additions & 2 deletions x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
@@ -5332,8 +5332,6 @@
"indexPatternManagement.editIndexPattern.scripted.deleteField.cancelButton": "キャンセル",
"indexPatternManagement.editIndexPattern.scripted.deleteField.deleteButton": "削除",
"indexPatternManagement.editIndexPattern.scripted.deleteFieldLabel": "スクリプトフィールド''{fieldName}''を削除しますか?",
"indexPatternManagement.editIndexPattern.scripted.deprecationLangHeader": "廃止された言語が使用されています",
"indexPatternManagement.editIndexPattern.scripted.deprecationLangLabel.deprecationLangDetail": "次の廃止された言語が使用されています。{deprecatedLangsInUse}これらの言語は、KibanaとElasticsearchの次のメジャーバージョンでサポートされなくなります。問題を避けるため、スクリプトフィールドを{link}に変換してください。",
"indexPatternManagement.editIndexPattern.scripted.deprecationLangLabel.painlessDescription": "Painless",
"indexPatternManagement.editIndexPattern.scripted.newFieldPlaceholder": "新規スクリプトフィールド",
"indexPatternManagement.editIndexPattern.scripted.table.deleteDescription": "このフィールドを削除します",
2 changes: 0 additions & 2 deletions x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
@@ -5263,8 +5263,6 @@
"indexPatternManagement.editIndexPattern.mappingConflictLabel": "{conflictFieldsLength, plural, one {一个字段} other {# 个字段}}已在匹配此模式的各个索引中定义为多个类型(字符串、整数等)。您也许仍能够在 Kibana 的各个部分中使用这些冲突字段,但它们将无法用于需要 Kibana 知道其类型的函数。要解决此问题,需要重新索引您的数据。",
"indexPatternManagement.editIndexPattern.scripted.deleteField.cancelButton": "取消",
"indexPatternManagement.editIndexPattern.scripted.deleteField.deleteButton": "删除",
"indexPatternManagement.editIndexPattern.scripted.deprecationLangHeader": "在用的过时语言",
"indexPatternManagement.editIndexPattern.scripted.deprecationLangLabel.deprecationLangDetail": "以下过时的语言仍在使用:{deprecatedLangsInUse}。Kibana 和 Elasticsearch 的下一主要版本将移除对这些语言的支持。将您的脚本字段转换成 {link} 以避免问题。",
"indexPatternManagement.editIndexPattern.scripted.deprecationLangLabel.painlessDescription": "Painless",
"indexPatternManagement.editIndexPattern.scripted.newFieldPlaceholder": "新建脚本字段",
"indexPatternManagement.editIndexPattern.scripted.table.deleteDescription": "删除此字段",