Package org.elasticsearch.script
Class ScriptMetadata.Builder
java.lang.Object
org.elasticsearch.script.ScriptMetadata.Builder
- Enclosing class:
- ScriptMetadata
public static final class ScriptMetadata.Builder
extends java.lang.Object
A builder used to modify the currently stored scripts data held within
the
ClusterState
. Scripts can be added or deleted, then built
to generate a new Map
of scripts that will be used to update
the current ClusterState
.-
Constructor Summary
Constructors Constructor Description Builder(ScriptMetadata previous)
-
Method Summary
Modifier and Type Method Description ScriptMetadata
build()
ScriptMetadata.Builder
deleteScript(java.lang.String id)
Delete a script from the existing stored scripts based on a user-specified id.ScriptMetadata.Builder
storeScript(java.lang.String id, StoredScriptSource source)
Add a new script to the existing stored scripts based on a user-specified id.
-
Constructor Details
-
Builder
- Parameters:
previous
- The currentScriptMetadata
ornull
if there is no existingScriptMetadata
.
-
-
Method Details
-
storeScript
Add a new script to the existing stored scripts based on a user-specified id. If a script with the same id already exists it will be overwritten.- Parameters:
id
- The user-specified id to use for the look up.source
- The user-specified stored script data held inStoredScriptSource
.
-
deleteScript
Delete a script from the existing stored scripts based on a user-specified id.- Parameters:
id
- The user-specified id to use for the look up.
-
build
- Returns:
- A
ScriptMetadata
with the updatedMap
of scripts.
-