Package org.elasticsearch.script
Enum ScriptType
- java.lang.Object
-
- java.lang.Enum<ScriptType>
-
- org.elasticsearch.script.ScriptType
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<ScriptType>
,java.lang.constant.Constable
,Writeable
public enum ScriptType extends java.lang.Enum<ScriptType> implements Writeable
ScriptType represents the way a script is stored and retrieved from theScriptService
. It's also used to byScriptService
to determine whether or not aScript
is allowed to be executed based on both default and user-defined settings.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.lang.Enum
java.lang.Enum.EnumDesc<E extends java.lang.Enum<E>>
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
-
Enum Constant Summary
Enum Constants Enum Constant Description INLINE
INLINE scripts are specified in numerous queries and compiled on-the-fly.STORED
STORED scripts are saved as part of theClusterState
based on user requests.
-
Method Summary
Modifier and Type Method Description int
getId()
java.lang.String
getName()
ParseField
getParseField()
boolean
isDefaultEnabled()
static ScriptType
readFrom(StreamInput in)
Reads an int from the input stream and converts it to aScriptType
.java.lang.String
toString()
static ScriptType
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static ScriptType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.void
writeTo(StreamOutput out)
Write this into the StreamOutput.
-
-
-
Enum Constant Detail
-
INLINE
public static final ScriptType INLINE
INLINE scripts are specified in numerous queries and compiled on-the-fly. They will be cached based on the lang and code of the script. They are turned off by default because most languages are insecure (Groovy and others), but can be overridden by the specificScriptEngine
if the language is naturally secure (Painless, Mustache, and Expressions).
-
STORED
public static final ScriptType STORED
STORED scripts are saved as part of theClusterState
based on user requests. They will be cached when they are first used in a query. They are turned off by default because most languages are insecure (Groovy and others), but can be overridden by the specificScriptEngine
if the language is naturally secure (Painless, Mustache, and Expressions).
-
-
Method Detail
-
values
public static ScriptType[] values()
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ScriptType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
readFrom
public static ScriptType readFrom(StreamInput in) throws java.io.IOException
Reads an int from the input stream and converts it to aScriptType
.- Returns:
- The ScriptType read from the stream. Throws an
IllegalStateException
if no ScriptType is found based on the id. - Throws:
java.io.IOException
-
writeTo
public void writeTo(StreamOutput out) throws java.io.IOException
Description copied from interface:Writeable
Write this into the StreamOutput.
-
getId
public int getId()
- Returns:
- The unique id for this
ScriptType
.
-
getName
public java.lang.String getName()
- Returns:
- The unique name for this
ScriptType
based on theParseField
.
-
getParseField
public ParseField getParseField()
- Returns:
- Specifies the name used to parse input from queries.
-
isDefaultEnabled
public boolean isDefaultEnabled()
- Returns:
- Whether or not a
ScriptType
can be run by default. Note this can be potentially overridden by anyScriptEngine
.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Enum<ScriptType>
- Returns:
- The same as calling
getName()
.
-
-