-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
6.0 Script changes #2951
6.0 Script changes #2951
Conversation
- Groovy, JavaScript, and Python languages removededit The Groovy, JavaScript, and Python scripting languages were deprecated in elasticsearch 5.0 and have now been removed. Use painless instead. - lang can no longer be specified when using a stored script as part of a requestedit The lang variable can no longer be specified as part of a request that uses a stored script otherwise an error will occur. Note that a request using a stored script is different from a request that puts a stored script. The language of the script has already been stored as part of the cluster state and an id is sufficient to access all of the information necessary to execute a stored script. - lang can no longer be used when putting, getting, or deleting a stored scriptedit Stored scripts can no longer have the lang parameter specified as part of the url when performing PUT, GET, and DELETE actions on the _scripts/ path. All stored scripts must have a unique id as the namespace is only id now and no longer lang and id.
|
||
namespace Nest | ||
{ | ||
[JsonObject(MemberSerialization = MemberSerialization.OptIn)] | ||
[JsonConverter(typeof(ReadAsTypeJsonConverter<StoredScript>))] | ||
public interface IStoredScript | ||
{ | ||
[JsonProperty("lang")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can still specify lang as part of the body, its just no longer part of the path in the url:
private static readonly string Lang = ScriptLang.Expression.GetStringValue(); | ||
public LuceneExpressionScript(string source) : base(Lang, source) { } | ||
} | ||
public class MustacheScript : StoredScript |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private static readonly string Lang = ScriptLang.Python.GetStringValue(); | ||
public PythonScript(string source) : base(Lang, source) { } | ||
} | ||
public class LuceneExpressionScript : StoredScript |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public PutScriptDescriptor Groovy(string source) => Assign(a => a.Script = new GroovyScript(source)); | ||
public PutScriptDescriptor JavaScript(string source) => Assign(a => a.Script = new JavaScriptScript(source)); | ||
public PutScriptDescriptor Python(string source) => Assign(a => a.Script = new PythonScript(source)); | ||
public PutScriptDescriptor LuceneExpression(string source) => Assign(a => a.Script = new LuceneExpressionScript(source)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep LuceneExpression
and Mustache
Remove no longer supported languages from ScriptLang enum
PR may contradict breaking change information here: https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking_60_scripting_changes.html#_stored_search_template_apis_removed
Groovy, JavaScript, and Python languages removed
The Groovy, JavaScript, and Python scripting languages were deprecated in elasticsearch 5.0 and have now been removed. Use painless instead.
lang can no longer be specified when using a stored script as part of a request
The lang variable can no longer be specified as part of a request that uses a stored script otherwise an error will occur. Note that a request using a stored script is different from a request that puts a stored script. The language of the script has already been stored as part of the cluster state and an id is sufficient to access all of the information necessary to execute a stored script.
lang can no longer be used when putting, getting, or deleting a stored script
Stored scripts can no longer have the lang parameter specified as part of the url when performing PUT, GET, and DELETE actions on the _scripts/ path. All stored scripts must have a unique id as the namespace is only id now and no longer lang and id.
Addresses: #2935
and items on #2923