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

Hardcode painless as the default scripting lang and add legacy script default for stored scripts #20310

Merged
merged 1 commit into from
Sep 6, 2016

Conversation

martijnvg
Copy link
Member

  • Removed script.default_lang setting and made painless the hardcoded default script language.
    • The default script language is now maintained in Script class.
  • Added script.legacy.default_lang setting that controls the default language for scripts that are stored inside documents (for example percolator queries). This defaults to groovy.
    • Added QueryParseContext#getDefaultScriptLanguage() that manages the default scripting language. Returns always painless, unless loading query/search request in legacy mode then the returns what is configured in script.legacy.default_lang setting.
    • In the aggregation parsing code added ParserContext that also holds the default scripting language like QueryParseContext. Most parser don't have access to QueryParseContext. This is for scripts in aggregations.
  • The lang script field is always serialized (toXContent).

PR for #20122

Need to add tests and docs, but before adding those I'd like to get some feedback.

@martijnvg martijnvg added WIP :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache labels Sep 2, 2016
}

public static String getLegacyDefaultLang(Settings settings) {
return settings.get("script.legacy.default_lang", ScriptSettings.LEGACY_DEFAULT_LANG);
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

oops, will fix

@s1monw
Copy link
Contributor

s1monw commented Sep 5, 2016

I really think we need a test for this. maybe we can build a bwc index with a script in the percolator? Maybe we can even fake it in a unittest and build a lucene index ourself, start an indexservice etc. to test this. Otherwise this looks awesome

@s1monw
Copy link
Contributor

s1monw commented Sep 5, 2016

I think we can remove the WIP label here too

@martijnvg
Copy link
Member Author

@s1monw I've updated the PR and replaced the WIP label with review label.

@s1monw
Copy link
Contributor

s1monw commented Sep 6, 2016

LGTM great solution, good tests, well done! thanks mate!

…oded default script language.

** The default script language is now maintained in `Script` class.
* Added `script.legacy.default_lang` setting that controls the default language for scripts that are stored inside documents (for example percolator queries).  This defaults to groovy.
** Added `QueryParseContext#getDefaultScriptLanguage()` that manages the default scripting language. Returns always `painless`, unless loading query/search request in legacy mode then the returns what is configured in `script.legacy.default_lang` setting.
** In the aggregation parsing code added `ParserContext` that also holds the default scripting language like `QueryParseContext`. Most parser don't have access to `QueryParseContext`. This is for scripts in aggregations.
* The `lang` script field is always serialized (toXContent).

Closes elastic#20122
@martijnvg martijnvg merged commit 245882c into elastic:master Sep 6, 2016
@clintongormley clintongormley changed the title Make the painless hardcoded default and add legacy script default for stored scripts Hardcode painless as the default scripting lang and add legacy script default for stored scripts Sep 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>breaking :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache v5.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants