Package org.elasticsearch.script.field
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 Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondouble
asDouble
(double defaultValue) Returns the 0th index value as adouble
if it exists, otherwisedefaultValue
.double
asDouble
(int index, double defaultValue) Returns the value atindex
as adouble
if it exists, otherwisedefaultValue
.Converts all the values toDouble
and returns them as aList
.float
get
(double defaultValue) Does a downcast for defaultValue from a double to a float to allow users to avoid explicit casting.float
get
(int index, double defaultValue) Does a downcast for defaultValue from a double to a float to allow users to avoid explicit casting.getInternal
(int index) getName()
Returns the name of this field.Returns aScriptDocValues
of the appropriate type for this field.boolean
isEmpty()
Returnstrue
if this field has no values, otherwisefalse
.iterator()
protected void
resize
(int newSize) void
setNextDocId
(int docId) Set the current document ID.int
size()
Returns the number of values this field has.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
input
-
name
-
values
protected double[] values -
count
protected int count
-
-
Constructor Details
-
HalfFloatDocValuesField
-
-
Method Details
-
setNextDocId
Description copied from interface:DocValuesField
Set the current document ID.- Specified by:
setNextDocId
in interfaceDocValuesField<Float>
- Specified by:
setNextDocId
in interfaceScriptDocValues.Supplier<Double>
- Throws:
IOException
-
resize
protected void resize(int newSize) -
getScriptDocValues
Description copied from interface:DocValuesField
Returns aScriptDocValues
of the appropriate type for this field. This is used to support backwards compatibility for accessing field values through thedoc
variable.- Specified by:
getScriptDocValues
in interfaceDocValuesField<Float>
-
getInternal
- Specified by:
getInternal
in interfaceScriptDocValues.Supplier<Double>
-
getName
Description copied from interface:Field
Returns the name of this field. -
isEmpty
public boolean isEmpty()Description copied from interface:Field
Returnstrue
if this field has no values, otherwisefalse
. -
size
public int size()Description copied from interface:Field
Returns the number of values this field has. -
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
-
asDoubles
Converts all the values toDouble
and returns them as aList
. -
asDouble
public double asDouble(double defaultValue) Returns the 0th index value as adouble
if it exists, otherwisedefaultValue
. -
asDouble
public double asDouble(int index, double defaultValue) Returns the value atindex
as adouble
if it exists, otherwisedefaultValue
.
-