Class WriteField

java.lang.Object
org.elasticsearch.script.field.WriteField
All Implemented Interfaces:
Iterable<Object>, Field<Object>

public final class WriteField extends Object implements Field<Object>
  • Constructor Details

  • Method Details

    • getName

      public String getName()
      Get the path represented by this Field
      Specified by:
      getName in interface Field<Object>
    • exists

      public boolean exists()
      Does the path exist?
    • move

      public WriteField move(String path)
      Move this path to another path in the map.
      Throws:
      IllegalArgumentException - if the other path has contents
    • move

      public WriteField move(WriteField path)
      Move this path to the path of the given WriteField, using that WriteFields root, which may be a NestedDocument.
      Throws:
      IllegalArgumentException - if the other path has contents
    • move

      public WriteField move(Object path)
      The painless API for move, delegates to move(String) or move(WriteField), throws an IllegalArgumentException if is neither a String nor a WriteField. This is necessary because Painless does not support method overloading, only arity overloading.
    • overwrite

      public WriteField overwrite(String path)
      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

      public WriteField overwrite(WriteField path)
      Move this path to the path represented by another WriteField, using that WriteFields root, which may be a NestedDocument. Overwrites the destination path if it exists. If this Field has no value, the value at is removed.
    • overwrite

      public WriteField overwrite(Object path)
      The painless API for overwrite, delegates to overwrite(String) or overwrite(WriteField), throws an IllegalArgumentException if is neither a String nor a WriteField. This is necessary because Painless does not support method overloading, only arity overloading.
    • remove

      public void remove()
      Removes this path from the map.
    • set

      public WriteField set(Object value)
      Sets the value for this path. Creates nested path if necessary.
    • append

      public WriteField append(Object value)
      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?
      Specified by:
      isEmpty in interface Field<Object>
    • size

      public int size()
      How many elements are at the leaf of this path?
      Specified by:
      size in interface Field<Object>
    • iterator

      public Iterator<Object> iterator()
      Iterate through all elements of this path
      Specified by:
      iterator in interface Iterable<Object>
    • get

      public Object get(Object defaultValue)
      Get the value at this path, if there is no value then get the provided
    • get

      public Object get(int index, Object defaultValue)
      Get the value at the given index at this path or if there is no such value.
    • hasValue

      public boolean hasValue(Predicate<Object> predicate)
      Is there any value matching at this path?
    • transform

      public WriteField transform(Function<Object,Object> transformer)
      Update each value at this path with the Function.
    • deduplicate

      public WriteField deduplicate()
      Remove all duplicate values from this path. List order is not preserved.
    • removeValuesIf

      public WriteField removeValuesIf(Predicate<Object> filter)
      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

      public WriteField removeValue(int index)
      Remove the value at , if it exists. If there is only one value and is zero, remove the mapping.
    • doc

      public NestedDocument doc()
      Append a NestedDocument to this field and return it.
    • doc

      public NestedDocument doc(int index)
      Returns a NestedDocument 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

      public Iterable<NestedDocument> docs()
      Iterable over all NestedDocuments in this field.