java.lang.Object
org.elasticsearch.script.Metadata
org.elasticsearch.script.ReindexMetadata
Metadata for the
ReindexScript
context.
_index, _id, _version, _routing are all read-write. _id, _version and _routing are also nullable.
_now is millis since epoch and read-only
op is read-write one of 'index', 'noop', 'delete'
If _version is set to null in the ctx map, that is interpreted as using internal versioning.
The setVersionToInternal(Metadata)
and isVersionInternal(Metadata)
augmentations
are provided for users of this class. These augmentations allow the class to appear as Metadata
but handle the internal versioning scheme without scripts accessing the ctx map.-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.script.Metadata
Metadata.FieldProperty<T>, Metadata.MapOperation
-
Field Summary
Modifier and TypeFieldDescriptionprotected final String
protected final String
protected final String
protected final Long
Fields inherited from class org.elasticsearch.script.Metadata
BAD_KEY, DYNAMIC_TEMPLATES, ID, IF_PRIMARY_TERM, IF_SEQ_NO, INDEX, LongField, map, NOW, ObjectField, OP, ROUTING, StringField, TYPE, VERSION, VERSION_TYPE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
Get version, if it's null, return sentinel valueLong.MIN_VALUE
boolean
boolean
boolean
static boolean
isVersionInternal
(Metadata receiver) Augmentation to allowReindexScript
s to check if the version is set to "internal"Create the backing metadata map with the standard contents assuming default validators.boolean
static void
setVersionToInternal
(Metadata receiver) Augmentation to allowReindexScript
s to set the version to "internal".boolean
Methods inherited from class org.elasticsearch.script.Metadata
clone, containsKey, containsValue, equals, get, getDynamicTemplates, getId, getIfPrimaryTerm, getIfSeqNo, getIndex, getMap, getNow, getNumber, getOp, getRouting, getString, getVersionType, hashCode, isAvailable, keySet, put, remove, setId, setIndex, setOp, setRouting, setVersion, setVersionType, size, stringSetValidator, validateMetadata
-
Field Details
-
index
-
id
-
version
-
routing
-
-
Constructor Details
-
ReindexMetadata
-
-
Method Details
-
metadataMap
protected static Map<String,Object> metadataMap(String index, String id, Long version, String routing, String op, long timestamp) Create the backing metadata map with the standard contents assuming default validators. -
getVersion
public long getVersion()Get version, if it's null, return sentinel valueLong.MIN_VALUE
- Overrides:
getVersion
in classMetadata
-
isVersionInternal
public boolean isVersionInternal() -
isVersionInternal
Augmentation to allowReindexScript
s to check if the version is set to "internal" -
setVersionToInternal
Augmentation to allowReindexScript
s to set the version to "internal". This is necessary becauseMetadata.setVersion(long)
takes a primitive long. -
versionChanged
public boolean versionChanged() -
indexChanged
public boolean indexChanged() -
idChanged
public boolean idChanged() -
routingChanged
public boolean routingChanged()
-