Skip to content

Ingest support for Scripting Fields API #79155

@stu-elastic

Description

@stu-elastic

Add ingest support for the fields api, #61388.

Important APIs for ingestion:

  • static Stream<Field> fields(fieldglob)
    Retrieve all fields within the document as a stream.

Field<T> interface

  • void remove()
    Remove this field from the document.

  • boolean removeIf(Predicate<Field> predicate)
    Removes this field if it matches the predicate.

  • void renameTo(String name)
    Rename this field to the specified name. Throws an exception if the specified name is already a field.

  • void overwriteTo(String name)
    Rename the field to the specified name. Overwrites an existing field of the same name if it exists.

  • void setValue(T value)
    Set the field to a single value.

  • void setValues(List<T> values)
    Set the field to a list of values.

  • void appendValue(T value)
    Adds a value to the field source. If the field is mapped, the type of the value is verified. If the field does not yet exist, it is created, including any intermediate fields.

  • void appendValues(List<T> value)
    List form of appendValue.

  • boolean removeValue(T value)
    Remove a value from this field if it exists, returns true if removed.

  • boolean removeValuesIf(Predicate<T> predicate)
    Removes the set of values from the field that match the predicate, returns true if any values have been removed

  • void removeDuplicateValues()
    Removes any duplicate values this field has.

  • void transformValues(Function<T, T> function)
    Replace each existing value with the return of the specified function.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions