summaryrefslogtreecommitdiff
path: root/core/src/test/java/org/elasticsearch/script/ScriptTests.java
AgeCommit message (Collapse)Author
2017-04-04Rename random ASCII helper methodsJason Tedor
This commit renames the random ASCII helper methods in ESTestCase. This is because this method ultimately uses the random ASCII methods from randomized runner, but these methods actually only produce random strings generated from [a-zA-Z]. Relates #23886
2017-02-22Convert script/template objects to json formatjavanna
Elasticsearch accepts multiple content-type formats, hence scripts can be stored/provided in json, yaml, cbor or smile. Yet the format that should be used internally is json. This is a problem mainly around search templates, as they only support json out of the four content-types, so instead of maintaining the content-type of the request we should rather convert the scripts/templates to json. Binary formats were not previously supported. If you stored a template in yaml format, you'd get back an error "No encoder found for MIME type [application/yaml]" when trying to execute it. With this commit the request content-type is independent from the template, which always gets converted to json internally. That is transparent to users and doesn't affect the content type of the response obtained when executing the template.
2017-01-31Change Namespace for Stored Script to Only Use Id (#22206)Jack Conradson
Currently, stored scripts use a namespace of (lang, id) to be put, get, deleted, and executed. This is not necessary since the lang is stored with the stored script. A user should only have to specify an id to use a stored script. This change makes that possible while keeping backwards compatibility with the previous namespace of (lang, id). Anywhere the previous namespace is used will log deprecation warnings. The new behavior is the following: When a user specifies a stored script, that script will be stored under both the new namespace and old namespace. Take for example script 'A' with lang 'L0' and data 'D0'. If we add script 'A' to the empty set, the scripts map will be ["A" -- D0, "A#L0" -- D0]. If a script 'A' with lang 'L1' and data 'D1' is then added, the scripts map will be ["A" -- D1, "A#L1" -- D1, "A#L0" -- D0]. When a user deletes a stored script, that script will be deleted from both the new namespace (if it exists) and the old namespace. Take for example a scripts map with {"A" -- D1, "A#L1" -- D1, "A#L0" -- D0}. If a script is removed specified by an id 'A' and lang null then the scripts map will be {"A#L0" -- D0}. To remove the final script, the deprecated namespace must be used, so an id 'A' and lang 'L0' would need to be specified. When a user gets/executes a stored script, if the new namespace is used then the script will be retrieved/executed using only 'id', and if the old namespace is used then the script will be retrieved/executed using 'id' and 'lang'
2017-01-05remove ParseFieldMatcher usages from Script parsing codejavanna
2016-12-13Consolidate more parser creation into ESTestCaseNik Everett
This will make it easier to add the forthcoming required argument, `NamedXContentRegistry`.
2016-11-10Clean up of Script.Jack Conradson
Closes #21321
2016-10-26Refactor ScriptType to be a top-level class.Jack Conradson
2016-08-18tests for Script parsing and serializationMartijn van Groningen