Class EmptyField<T>

java.lang.Object
org.elasticsearch.script.Field<T>
org.elasticsearch.script.EmptyField<T>

public class EmptyField<T> extends Field<T>
Script field with no mapping, always returns defaultValue.
  • Constructor Details

    • EmptyField

      public EmptyField(String name)
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Description copied from class: Field
      Does the field have any values? An unmapped field may have values from source
      Overrides:
      isEmpty in class Field<T>
    • getValues

      public List<T> getValues()
      Description copied from class: Field
      Get all values of a multivalued field. If isEmpty() this returns an empty list
      Overrides:
      getValues in class Field<T>
    • convert

      public <CT,​ CF extends Field<CT>> Field<CT> convert(Converter<CT,​CF> converter)
      Description copied from class: Field
      Extensions outside the core package should override this method to implement their own conversions, calling the superclass of this method as a fallback.
      Overrides:
      convert in class Field<T>
    • getValue

      public T getValue(T defaultValue)
      Description copied from class: Field
      Get the first value of a field, if isEmpty() return defaultValue instead
      Overrides:
      getValue in class Field<T>
    • getDouble

      public double getDouble(double defaultValue)
      Description copied from class: Field
      Get the underlying value as a double unless Field.isEmpty(), in which case return defaultValue. May throw InvalidConversion if the underlying value is not representable as a double.
      Overrides:
      getDouble in class Field<T>
    • getLong

      public long getLong(long defaultValue)
      Description copied from class: Field
      Get the underlying value as a long unless Field.isEmpty(), in which case return defaultValue. May throw InvalidConversion if the underlying value is not representable as a long.
      Overrides:
      getLong in class Field<T>