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
|
Modifier and Type | Method and Description |
---|---|
protected void |
doReadFrom(StreamInput in) |
protected void |
doWriteTo(StreamOutput out) |
boolean |
equals(Object obj) |
String |
getLang()
Method for getting language.
|
Map<String,Object> |
getParams()
Method for getting the parameters.
|
String |
getScript()
Method for getting the script.
|
ScriptService.ScriptType |
getType()
Method for getting the type.
|
int |
hashCode() |
static Script |
parse(Map<String,Object> config,
boolean removeMatchedEntries,
ParseFieldMatcher parseFieldMatcher) |
static Script |
parse(XContentParser parser,
ParseFieldMatcher parseFieldMatcher) |
void |
readFrom(StreamInput in) |
static Script |
readScript(StreamInput in) |
protected XContentBuilder |
scriptFieldToXContent(String script,
ScriptService.ScriptType type,
XContentBuilder builder,
ToXContent.Params builderParams) |
String |
toString() |
XContentBuilder |
toXContent(XContentBuilder builder,
ToXContent.Params builderParams) |
void |
writeTo(StreamOutput out) |
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–2017. All rights reserved.