Skip to content

Conversation

@codebrain
Copy link
Contributor

@codebrain codebrain commented Dec 13, 2017

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

- 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.
@codebrain codebrain requested a review from Mpdreamz December 13, 2017 06:38
[JsonConverter(typeof(ReadAsTypeJsonConverter<StoredScript>))]
public interface IStoredScript
{
[JsonProperty("lang")]
Copy link
Member

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:

https://github.com/elastic/elasticsearch/blob/master/core/src/main/java/org/elasticsearch/script/StoredScriptSource.java#L157

private static readonly string Lang = ScriptLang.Expression.GetStringValue();
public LuceneExpressionScript(string source) : base(Lang, source) { }
}
public class MustacheScript : StoredScript
Copy link
Member

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
Copy link
Member

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));
Copy link
Member

Choose a reason for hiding this comment

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

Keep LuceneExpression and Mustache

codebrain and others added 2 commits December 14, 2017 11:53
@russcam russcam merged commit 2f2a0e3 into master Dec 14, 2017
@Mpdreamz Mpdreamz deleted the feature/remove-lang-from-stored-script branch January 30, 2018 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants