Deprecation warnings for scripted fields#9193
Conversation
weltenwort
left a comment
There was a problem hiding this comment.
Good stuff, left just a few suggestions in the comments.
| </h4> | ||
| <p> | ||
| <span class="text-capitalize">{{editor.field.lang}}</span> is deprecated and support will be removed in the | ||
| next major version of Kibana and Elasticsearch. We recommend using Painless for new scripted fields. |
There was a problem hiding this comment.
Linking to the Painless docs in the index-level warning is a great idea. Let's do the same here.
| $scope.getDeprecatedLanguagesInUse = function () { | ||
| const fields = $scope.indexPattern.getScriptedFields(); | ||
| const langsInUse = _.uniq(_.map(fields, 'lang')); | ||
| return _.difference(langsInUse, ['expression', 'painless']); |
There was a problem hiding this comment.
Extracting the array of supported languages into a constant somewhere would allow to reduce duplication with the field editor.
| }; | ||
|
|
||
| self.isSupportedLang = function (lang) { | ||
| return _.contains(['expression', 'painless'], lang); |
There was a problem hiding this comment.
Extracting the array of supported languages into a constant somewhere would allow to reduce duplication with the scripted field list.
* Added painless doc link to field editor deprecation warning * Extracted scripting lang logic into a reuseable module * Fixed issue where deprecation warning showed on field editor page if scripting was completely disabled in ES
|
@weltenwort I've addressed your comments, ready for another look! |
|
Gonna wait to merge until we decide if #9172 will go into 5.x, cause I'd like to test them together if we do. |
|
Leaving #9172 in 6.0 only for now, so merging in 3.. 2.. 1.. 💥 |
This PR adds deprecation warnings on the scripted field list page and the scripted field creation page when languages other than
expressionandpainlessare being used.If any existing scripted fields are using a deprecated language, they'll see this warning:
If a user attempts to create a new scripted field with a deprecated language they'll see this warning:
To test you'll need to enable at least groovy in Elasticsearch. You can do this easily by modifying your esvm.js file and adding the following block to the config:
Fixes #9174