public class Script extends Object implements ToXContent, Streamable
Modifier and Type | Class and Description |
---|---|
static interface |
Script.ScriptField |
static class |
Script.ScriptParseException |
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Modifier and Type | Field and Description |
---|---|
static ScriptService.ScriptType |
DEFAULT_TYPE |
EMPTY_PARAMS
Modifier | Constructor and Description |
---|---|
|
Script(String script)
Constructor for simple inline script.
|
|
Script(String script,
ScriptService.ScriptType type,
String lang,
Map<String,? extends Object> params)
Constructor for Script.
|
protected |
Script(String script,
String lang)
For sub-classes to use to override the default language
|
public static final ScriptService.ScriptType DEFAULT_TYPE
public Script(String script)
script
- The inline script to execute.protected Script(String script, String lang)
public Script(String script, ScriptService.ScriptType type, @Nullable String lang, @Nullable Map<String,? extends Object> params)
script
- The cache key of the script to be compiled/executed. For
inline scripts this is the actual script source code. For
indexed scripts this is the id used in the request. For on
file scripts this is the file name.type
- The type of script -- dynamic, indexed, or file.lang
- The language of the script to be compiled/executed.params
- The map of parameters the script will be executed with.public String getScript()
public ScriptService.ScriptType getType()
public String getLang()
public Map<String,Object> getParams()
public final void readFrom(StreamInput in) throws IOException
readFrom
in interface Streamable
IOException
protected void doReadFrom(StreamInput in) throws IOException
IOException
public final void writeTo(StreamOutput out) throws IOException
writeTo
in interface Streamable
IOException
protected void doWriteTo(StreamOutput out) throws IOException
IOException
public final XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params builderParams) throws IOException
toXContent
in interface ToXContent
IOException
protected XContentBuilder scriptFieldToXContent(String script, ScriptService.ScriptType type, XContentBuilder builder, ToXContent.Params builderParams) throws IOException
IOException
public static Script readScript(StreamInput in) throws IOException
IOException
public static Script parse(Map<String,Object> config, boolean removeMatchedEntries, ParseFieldMatcher parseFieldMatcher)
public static Script parse(XContentParser parser, ParseFieldMatcher parseFieldMatcher) throws IOException
IOException
Copyright © 2009–2016. All rights reserved.