summaryrefslogtreecommitdiff
path: root/core/src/main/java/org/elasticsearch/search/fetch/subphase/ScriptFieldsContext.java
diff options
context:
space:
mode:
authorRyan Ernst <ryan@iernst.net>2017-05-30 16:32:14 -0700
committerGitHub <noreply@github.com>2017-05-30 16:32:14 -0700
commit7c1211d2ed93640086c5da16871fab24d2bed46b (patch)
tree3fa5de2f9146e5bab4205b5e54a9c3ebe6367769 /core/src/main/java/org/elasticsearch/search/fetch/subphase/ScriptFieldsContext.java
parent04daac2243d506aa72551ceb63c5c0f44c249d2c (diff)
Scripting: Add StatefulFactoryType as optional intermediate factory in script contexts (#24974)
ScriptContexts currently understand a FactoryType that can produce instances of the script InstanceType. However, for search scripts, this does not work as we have the concept of LeafSearchScript that is created per lucene segment. This commit effectively renames the existing SearchScript class into SearchScript.LeafFactory, which is a new, optional, class that can be defined within a ScriptContext. LeafSearchScript is effectively renamed back into SearchScript. This change allows the model of stateless factory -> stateful factory -> script instance to continue, but in a generic way that any script context may take advantage of. relates #20426
Diffstat (limited to 'core/src/main/java/org/elasticsearch/search/fetch/subphase/ScriptFieldsContext.java')
-rw-r--r--core/src/main/java/org/elasticsearch/search/fetch/subphase/ScriptFieldsContext.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/src/main/java/org/elasticsearch/search/fetch/subphase/ScriptFieldsContext.java b/core/src/main/java/org/elasticsearch/search/fetch/subphase/ScriptFieldsContext.java
index 79bacd7f93..9e43b0bdd3 100644
--- a/core/src/main/java/org/elasticsearch/search/fetch/subphase/ScriptFieldsContext.java
+++ b/core/src/main/java/org/elasticsearch/search/fetch/subphase/ScriptFieldsContext.java
@@ -28,10 +28,10 @@ public class ScriptFieldsContext {
public static class ScriptField {
private final String name;
- private final SearchScript script;
+ private final SearchScript.LeafFactory script;
private final boolean ignoreException;
- public ScriptField(String name, SearchScript script, boolean ignoreException) {
+ public ScriptField(String name, SearchScript.LeafFactory script, boolean ignoreException) {
this.name = name;
this.script = script;
this.ignoreException = ignoreException;
@@ -41,7 +41,7 @@ public class ScriptFieldsContext {
return name;
}
- public SearchScript script() {
+ public SearchScript.LeafFactory script() {
return this.script;
}