java.lang.Object
org.elasticsearch.script.field.WriteField
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAppends a value to this path.protected void
Create a new Map for each segment in path, if that segment is unmapped or mapped to null.Remove all duplicate values from this path.doc()
Append aNestedDocument
to this field and return it.doc
(int index) Returns aNestedDocument
at the index, if index is beyond the end of the List, creates empty NestedDocument through the end of the array to the index.docs()
Iterable over allNestedDocument
s in this field.boolean
exists()
Does the path exist?Get the value at the given index at this path or if there is no such value.Get the value at this path, if there is no value then get the providedFetch the value at the current location, changing a Map into a single element list.getName()
Get the path represented by this Fieldboolean
Is there any value matching at this path?boolean
isEmpty()
Is this path associated with any values?iterator()
Iterate through all elements of this pathThe painless API formove
, delegates tomove(String)
ormove(WriteField)
, throws anIllegalArgumentException
if is neither aString
nor aWriteField
.Move this path to another path in the map.move
(WriteField path) Move this path to the path of the givenWriteField
, using thatWriteField
s root, which may be aNestedDocument
.The painless API foroverwrite
, delegates tooverwrite(String)
oroverwrite(WriteField)
, throws anIllegalArgumentException
if is neither aString
nor aWriteField
.Move this path to another path in the map, overwriting the destination path if it exists.overwrite
(WriteField path) Move this path to the path represented by anotherWriteField
, using thatWriteField
s root, which may be aNestedDocument
.void
remove()
Removes this path from the map.removeValue
(int index) Remove the value at , if it exists.removeValuesIf
(Predicate<Object> filter) Remove all values at this path that match .protected void
Resolvepath
from the root.Sets the value for this path.protected void
setLeaf()
Get the path to a leaf or create it if one does not exist.protected void
int
size()
How many elements are at the leaf of this path?Update each value at this path with theFunction
.protected String
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
path
-
rootSupplier
-
container
-
leaf
-
-
Constructor Details
-
WriteField
-
-
Method Details
-
getName
Get the path represented by this Field -
exists
public boolean exists()Does the path exist? -
move
Move this path to another path in the map.- Throws:
IllegalArgumentException
- if the other path has contents
-
move
Move this path to the path of the givenWriteField
, using thatWriteField
s root, which may be aNestedDocument
.- Throws:
IllegalArgumentException
- if the other path has contents
-
move
The painless API formove
, delegates tomove(String)
ormove(WriteField)
, throws anIllegalArgumentException
if is neither aString
nor aWriteField
. This is necessary because Painless does not support method overloading, only arity overloading. -
overwrite
Move this path to another path in the map, overwriting the destination path if it exists. If this Field has no value, the value at is removed. -
overwrite
Move this path to the path represented by anotherWriteField
, using thatWriteField
s root, which may be aNestedDocument
. Overwrites the destination path if it exists. If this Field has no value, the value at is removed. -
overwrite
The painless API foroverwrite
, delegates tooverwrite(String)
oroverwrite(WriteField)
, throws anIllegalArgumentException
if is neither aString
nor aWriteField
. This is necessary because Painless does not support method overloading, only arity overloading. -
remove
public void remove()Removes this path from the map. -
set
Sets the value for this path. Creates nested path if necessary. -
append
Appends a value to this path. Creates the path and the List at the leaf if necessary. -
isEmpty
public boolean isEmpty()Is this path associated with any values? -
size
public int size()How many elements are at the leaf of this path? -
iterator
Iterate through all elements of this path -
get
Get the value at this path, if there is no value then get the provided -
get
Get the value at the given index at this path or if there is no such value. -
hasValue
Is there any value matching at this path? -
transform
Update each value at this path with theFunction
. -
deduplicate
Remove all duplicate values from this path. List order is not preserved. -
removeValuesIf
Remove all values at this path that match . If there is only one value and it matches , the mapping is removed, however empty Lists are retained. -
removeValue
Remove the value at , if it exists. If there is only one value and is zero, remove the mapping. -
doc
Append aNestedDocument
to this field and return it. -
doc
Returns aNestedDocument
at the index, if index is beyond the end of the List, creates empty NestedDocument through the end of the array to the index. -
getDocsAsList
Fetch the value at the current location, changing a Map into a single element list. The new list is written back to the leaf. If there is no value, returnnull
. If there is a value that is not a List or a Map, . -
docs
Iterable over allNestedDocument
s in this field. -
setPath
-
setLeaf
protected void setLeaf()Get the path to a leaf or create it if one does not exist. -
resolveDepthFlat
protected void resolveDepthFlat()Resolvepath
from the root. Tries to resolve the path one segment at a time, if the segment is not mapped to a Java Map, then treats that segment and the rest as the leaf if it resolves. a.b.c could be resolved as I) ['a']['b']['c'] if 'a' is a Map at the root and 'b' is a Map in 'a', 'c' need not exist in 'b'. II) ['a']['b.c'] if 'a' is a Map at the root and 'b' does not exist in 'a's Map but 'b.c' does. III) ['a.b.c'] if 'a' doesn't exist at the root but 'a.b.c' does.container
andleaf
and non-null if resolved. -
createDepth
protected void createDepth()Create a new Map for each segment in path, if that segment is unmapped or mapped to null.- Throws:
IllegalArgumentException
- if a non-leaf segment maps to a non-Map Object.
-
typeName
-