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

Limit scripted fields to painless and expression langs #9172

Merged
merged 1 commit into from
Dec 12, 2016

Conversation

Bargs
Copy link
Contributor

@Bargs Bargs commented Nov 22, 2016

We made a mistake in opening up Kibana scripted fields to any and all
langs enabled in Elasticsearch. Kibana needs to do some magic to get
certain scripted field features to work
(#9171) and we can't commit to
supporting anything beyond expression and painless scripts. On top of
that, the other languages are being removed in ES 6.0 anyway. This commit
makes that stance explicit by disallowing anything other than those two
choices.

Tomorrow I'll submit a PR to display deprecation messages in 5.x.

@Bargs Bargs added the review label Nov 22, 2016
@Bargs Bargs added the v6.0.0 label Nov 22, 2016
@tbragin tbragin added the Feature:Scripted Fields Scripted fields features label Nov 22, 2016
@weltenwort
Copy link
Member

I was wondering if it would make sense to perform that filtering on the server side.

Another option would be to move that check to a function named somthing like getSupportedScriptingLangs(), which does getScriptingLangs().then((langs) => _.intersection(langs, [...]). This would make that filtering reusable and attach an explanatory name to it (there are certainly better ones than getSupportedScriptingLangs).

@Bargs
Copy link
Contributor Author

Bargs commented Nov 22, 2016

I had thought about doing the filtering on the server side, but I really intended for that API to be a view into what's enabled in ES, not just a scripted field specific API.

Agreed on creating a separate function though.

@Bargs
Copy link
Contributor Author

Bargs commented Nov 29, 2016

@weltenwort pushed a couple updates, ready for another look.

  • Extracted scripting lang logic into a reusable module
  • Added breaking change documentation

Copy link
Member

@weltenwort weltenwort left a comment

Choose a reason for hiding this comment

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

Nice, that looks even better :)

I'm wondering about abbreviating languages to "langs". Not sure what our policy is regarding expressiveness vs bytes, but I prefer to err on the side of expressiveness. Mainly a matter of taste, I guess...

@@ -37,7 +39,7 @@ uiModules

self.docLinks = docLinks;
getScriptingLangs().then((langs) => {
self.scriptingLangs = langs;
self.scriptingLangs = _.intersection(langs, ['expression', 'painless']);
Copy link
Member

Choose a reason for hiding this comment

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

Can we DRY this up as well by re-using getSupportedScriptingLangs()? Maybe even factor out a filterSupportedSciptingLangs(languages) to encapsulate the _.intersection that is also used below? Or does that go too far?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I kind of like the flexibility of the existing functions. If you're ok with it, let's wait and see if we need a filterSupportedScriptingLangs elsewhere before creating it.

Copy link
Member

Choose a reason for hiding this comment

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

certainly 👍

@Bargs
Copy link
Contributor Author

Bargs commented Dec 7, 2016

I was on the fence about langs vs languages, you've convinced me to switch it :)

@Bargs
Copy link
Contributor Author

Bargs commented Dec 7, 2016

@epixa during our Discovery meeting @tbragin and I talked about targeting 5.x with this PR. The idea being that we would continue to allow users to edit existing groovy fields in 5.x but we wouldn't allow them to create new ones. Do you think that's safe, or would you still consider it a breaking change?

@epixa
Copy link
Contributor

epixa commented Dec 7, 2016

Do we have deprecation messages on it already? I might be OK with removing the ability to add new groovy scripted fields if we had a couple versions with the deprecation notice first. I don't like the idea of pulling the rug out without warning though.

We made a mistake in opening up Kibana scripted fields to any and all
langs enabled in Elasticsearch. Kibana needs to do some magic to get
certain scripted field features to work
(elastic#9171) and we can't commit to
supporting anything beyond expression and painless scripts. On top of
that, the other languages are being removed in ES 6.0 anyway. This commit
makes that stance explicit by disallowing anything other than those two
choices.
@Bargs
Copy link
Contributor Author

Bargs commented Dec 7, 2016

@epixa Not yet, there's a PR for that.

@Bargs
Copy link
Contributor Author

Bargs commented Dec 12, 2016

Gonna leave this in 6.0 only for now since we haven't displayed deprecation messages to users yet. We could consider backporting to a 5.x release later on after #9193 has been present in a couple releases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants