Class HalfFloatDocValuesField

java.lang.Object
org.elasticsearch.script.field.HalfFloatDocValuesField
All Implemented Interfaces:
Iterable<Float>, ScriptDocValues.Supplier<Double>, DocValuesField<Float>, Field<Float>

public class HalfFloatDocValuesField extends Object implements DocValuesField<Float>, ScriptDocValues.Supplier<Double>
  • Field Details

    • input

      protected final SortedNumericDoubleValues input
    • name

      protected final String name
    • values

      protected double[] values
    • count

      protected int count
  • Constructor Details

  • Method Details

    • setNextDocId

      public void setNextDocId(int docId) throws IOException
      Description copied from interface: DocValuesField
      Set the current document ID.
      Specified by:
      setNextDocId in interface DocValuesField<Float>
      Specified by:
      setNextDocId in interface ScriptDocValues.Supplier<Double>
      Throws:
      IOException
    • resize

      protected void resize(int newSize)
    • getScriptDocValues

      public ScriptDocValues<Double> getScriptDocValues()
      Description copied from interface: DocValuesField
      Returns a ScriptDocValues of the appropriate type for this field. This is used to support backwards compatibility for accessing field values through the doc variable.
      Specified by:
      getScriptDocValues in interface DocValuesField<Float>
    • getInternal

      public Double getInternal(int index)
      Specified by:
      getInternal in interface ScriptDocValues.Supplier<Double>
    • getName

      public String getName()
      Description copied from interface: Field
      Returns the name of this field.
      Specified by:
      getName in interface Field<Float>
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: Field
      Returns true if this field has no values, otherwise false.
      Specified by:
      isEmpty in interface Field<Float>
    • size

      public int size()
      Description copied from interface: Field
      Returns the number of values this field has.
      Specified by:
      size in interface Field<Float>
      Specified by:
      size in interface ScriptDocValues.Supplier<Double>
    • get

      public float get(double defaultValue)
      Does a downcast for defaultValue from a double to a float to allow users to avoid explicit casting.
    • get

      public float get(int index, double defaultValue)
      Does a downcast for defaultValue from a double to a float to allow users to avoid explicit casting.
    • iterator

      public Iterator<Float> iterator()
      Specified by:
      iterator in interface Iterable<Float>
    • asDoubles

      public List<Double> asDoubles()
      Converts all the values to Double and returns them as a List.
    • asDouble

      public double asDouble(double defaultValue)
      Returns the 0th index value as a double if it exists, otherwise defaultValue.
    • asDouble

      public double asDouble(int index, double defaultValue)
      Returns the value at index as a double if it exists, otherwise defaultValue.