summaryrefslogtreecommitdiff
path: root/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/TransportSearchTemplateAction.java
diff options
context:
space:
mode:
authorRyan Ernst <ryan@iernst.net>2017-04-21 17:53:03 -0700
committerGitHub <noreply@github.com>2017-04-21 17:53:03 -0700
commit473e98981bcbac246ade6f27da13aa0238b0c8f5 (patch)
treec6dd04e8ef0d3d1d5e4a575a25c0886f0493172c /modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/TransportSearchTemplateAction.java
parentaadc33d260f2ae4b9ba3bf1395c29f22f02885ce (diff)
Scripts: Remove unnecessary executable shortcut (#24264)
ScriptService has two executable methods, one which takes a CompiledScript, which is similar to search, and one that takes a raw Script and both compiles and returns an ExecutableScript for it. The latter is not needed, and the call sites which used one or the other were mixed. This commit removes the extra executable method in favor of callers first calling compile, then executable.
Diffstat (limited to 'modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/TransportSearchTemplateAction.java')
-rw-r--r--modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/TransportSearchTemplateAction.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/TransportSearchTemplateAction.java b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/TransportSearchTemplateAction.java
index d7b0406238..61f099f6c2 100644
--- a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/TransportSearchTemplateAction.java
+++ b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/TransportSearchTemplateAction.java
@@ -34,6 +34,7 @@ import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.query.QueryParseContext;
+import org.elasticsearch.script.CompiledScript;
import org.elasticsearch.script.ExecutableScript;
import org.elasticsearch.script.Script;
import org.elasticsearch.script.ScriptService;
@@ -71,7 +72,8 @@ public class TransportSearchTemplateAction extends HandledTransportAction<Search
try {
Script script = new Script(request.getScriptType(), TEMPLATE_LANG, request.getScript(),
request.getScriptParams() == null ? Collections.emptyMap() : request.getScriptParams());
- ExecutableScript executable = scriptService.executable(script, SEARCH);
+ CompiledScript compiledScript = scriptService.compile(script, SEARCH);
+ ExecutableScript executable = scriptService.executable(compiledScript, script.getParams());
BytesReference source = (BytesReference) executable.run();
response.setSource(source);