Skip to content

Scripting Fields API for reading #79165

@stu-elastic

Description

@stu-elastic

Add the read API

Field<T> interface
Represents a field that may or may not exist within a document.

  • String getName()
    Returns the name of the field.

  • boolean isEmpty()
    Checks if at least one value exists.

  • T getValue(T defaultValue)
    Returns the first value, if exists, otherwise returns defaultValue. This may access the first indexed value, or the document source if the field is not indexed and the source is available.

  • List<T> getValues()
    Returns values of the field, as if they were indexed. This may access indexed values, or the document source if the field is not indexed and the source is available.

  • boolean hasValue(Predicate<T> predicate) (post 8.1.0)
    Returns true if exactly one value exists and that value matches the specified predicate, otherwise false.

  • boolean containsValue(Predicate<T> predicate) (post 8.10)
    Returns true if any value matches the specified predicate, otherwise false.

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