public final class Script extends java.lang.Object implements ToXContent, Writeable
Modifier and Type | Class and Description |
---|---|
static interface |
Script.ScriptField |
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Writeable.Reader<V>, Writeable.Writer<V>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_SCRIPT_LANG |
EMPTY_PARAMS
Constructor and Description |
---|
Script(StreamInput in) |
Script(java.lang.String script)
Constructor for simple inline script.
|
Script(java.lang.String script,
ScriptService.ScriptType type,
java.lang.String lang,
java.util.Map<java.lang.String,?> params) |
Script(java.lang.String script,
ScriptService.ScriptType type,
java.lang.String lang,
java.util.Map<java.lang.String,?> params,
XContentType contentType)
Constructor for Script.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
XContentType |
getContentType() |
java.lang.String |
getLang()
Method for getting language.
|
java.util.Map<java.lang.String,java.lang.Object> |
getParams()
Method for getting the parameters.
|
java.lang.String |
getScript()
Method for getting the script.
|
ScriptService.ScriptType |
getType()
Method for getting the type.
|
int |
hashCode() |
static Script |
parse(XContentParser parser,
ParseFieldMatcher parseFieldMatcher) |
static Script |
parse(XContentParser parser,
ParseFieldMatcher parseFieldMatcher,
java.lang.String lang) |
java.lang.String |
toString() |
XContentBuilder |
toXContent(XContentBuilder builder,
ToXContent.Params builderParams) |
void |
writeTo(StreamOutput out)
Write this into the StreamOutput.
|
public static final java.lang.String DEFAULT_SCRIPT_LANG
public Script(java.lang.String script)
script
- The inline script to execute.public Script(java.lang.String script, ScriptService.ScriptType type, java.lang.String lang, @Nullable java.util.Map<java.lang.String,?> params)
public Script(java.lang.String script, ScriptService.ScriptType type, java.lang.String lang, @Nullable java.util.Map<java.lang.String,?> params, @Nullable XContentType contentType)
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, stored, or file.lang
- The language of the script to be compiled/executed.params
- The map of parameters the script will be executed with.contentType
- The XContentType
of the script. Only relevant for inline scripts that have not been
defined as a plain string, but as json or yaml content. This class needs this information
when serializing the script back to xcontent.public Script(StreamInput in) throws java.io.IOException
java.io.IOException
public void writeTo(StreamOutput out) throws java.io.IOException
Writeable
public java.lang.String getScript()
public ScriptService.ScriptType getType()
public java.lang.String getLang()
public java.util.Map<java.lang.String,java.lang.Object> getParams()
public XContentType getContentType()
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params builderParams) throws java.io.IOException
toXContent
in interface ToXContent
java.io.IOException
public static Script parse(XContentParser parser, ParseFieldMatcher parseFieldMatcher) throws java.io.IOException
java.io.IOException
public static Script parse(XContentParser parser, ParseFieldMatcher parseFieldMatcher, @Nullable java.lang.String lang) throws java.io.IOException
java.io.IOException
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object