java.lang.Object
org.elasticsearch.script.Metadata
- Direct Known Subclasses:
ReindexMetadata,UpdateByQueryMetadata,UpdateMetadata
Ingest and update metadata available to write scripts.
Provides a map-like interface for backwards compatibility with the ctx map.
-
put(String, Object)
- get(String)
- remove(String)
- containsKey(String)
- containsValue(Object)
- keySet() for iteration
- size()
- isAvailable(String) for determining if a key is a metadata key
Provides getters and setters for script usage.
Validates all updates whether originating in map-like interface or setters.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordThe properties of a metadata field.static enumThe operation being performed on the value in the map. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Metadata.FieldProperty<?>protected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringstatic Metadata.FieldProperty<Number>protected static final Stringstatic Metadata.FieldProperty<Object>protected static final Stringprotected final Map<String,Metadata.FieldProperty<?>> protected static final Stringstatic Metadata.FieldProperty<String>protected static final Stringprotected static final Stringprotected static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()booleancontainsKey(String key) Does the metadata contain the key?booleancontainsValue(Object value) Does the metadata contain the value.booleanGet the value associated withgetId()getIndex()getMap()Get the backing map, if modified then the guarantees of this class may not holdgetNow()protected NumberGet theNumberassociated with key, or nullgetOp()protected StringGet the String version of the value associated withkey, or nulllonginthashCode()booleanisAvailable(String key) Is this key a Metadata key? Aremove(java.lang.String)d key would return false forcontainsKey(String)but true for this call.keySet()Return the list of keys with mappingsCreate the mapping from key to value.Remove the mapping associated withvoidvoidvoidvoidsetRouting(String routing) voidsetVersion(long version) voidsetVersionType(String versionType) intsize()The number of metadata keys currently mapped.static BiConsumer<String,String> stringSetValidator(Set<String> valid) protected voidCheck that all metadata map contains only valid metadata and no extraneous keys
-
Field Details
-
INDEX
- See Also:
-
ID
- See Also:
-
ROUTING
- See Also:
-
VERSION_TYPE
- See Also:
-
VERSION
- See Also:
-
TYPE
- See Also:
-
NOW
- See Also:
-
OP
- See Also:
-
IF_SEQ_NO
- See Also:
-
IF_PRIMARY_TERM
- See Also:
-
DYNAMIC_TEMPLATES
- See Also:
-
ObjectField
-
StringField
-
LongField
-
map
-
properties
-
BAD_KEY
-
-
Constructor Details
-
Metadata
-
-
Method Details
-
validateMetadata
protected void validateMetadata()Check that all metadata map contains only valid metadata and no extraneous keys -
getIndex
-
setIndex
-
getId
-
setId
-
getRouting
-
setRouting
-
getVersionType
-
setVersionType
-
getVersion
public long getVersion() -
setVersion
public void setVersion(long version) -
getNow
-
getOp
-
setOp
-
getIfSeqNo
-
getIfPrimaryTerm
-
getDynamicTemplates
-
getString
Get the String version of the value associated withkey, or null -
getNumber
Get theNumberassociated with key, or null- Throws:
IllegalArgumentException- if the value is not aNumber
-
isAvailable
Is this key a Metadata key? Aremove(java.lang.String)d key would return false forcontainsKey(String)but true for this call. -
put
Create the mapping from key to value.- Throws:
IllegalArgumentException- ifisAvailable(String)is false or the key cannot be updated to the value.
-
containsKey
Does the metadata contain the key? -
containsValue
Does the metadata contain the value. -
get
Get the value associated with -
remove
Remove the mapping associated with- Throws:
IllegalArgumentException- ifisAvailable(String)is false or the key cannot be removed.
-
keySet
Return the list of keys with mappings -
size
public int size()The number of metadata keys currently mapped. -
clone
-
getMap
Get the backing map, if modified then the guarantees of this class may not hold -
equals
-
hashCode
public int hashCode() -
stringSetValidator
-