java.lang.Object
java.lang.Record
org.elasticsearch.search.vectors.VectorData
- All Implemented Interfaces:
Writeable,ToXContent,ToXContentFragment
public record VectorData(float[] floatVector, byte[] byteVector)
extends Record
implements Writeable, ToXContentFragment
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
Fields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionVectorData(float[] floatVector, byte[] byteVector) Creates an instance of aVectorDatarecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToBuffer(ByteBuffer byteBuffer) byte[]float[]byte[]Returns the value of thebyteVectorrecord component.booleanIndicates whether some other object is "equal to" this one.float[]Returns the value of thefloatVectorrecord component.static VectorDatafromBytes(byte[] vec) static VectorDatafromFloats(float[] vec) inthashCode()Returns a hash code value for this object.booleanisFloat()static VectorDataparseXContent(XContentParser parser) toString()Returns a string representation of this record class.toXContent(XContentBuilder builder, ToXContent.Params params) voidwriteTo(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.xcontent.ToXContentFragment
isFragment
-
Constructor Details
-
VectorData
- Throws:
IOException
-
VectorData
public VectorData(float[] floatVector, byte[] byteVector) Creates an instance of aVectorDatarecord class.- Parameters:
floatVector- the value for thefloatVectorrecord componentbyteVector- the value for thebyteVectorrecord component
-
-
Method Details
-
isFloat
public boolean isFloat() -
asByteVector
public byte[] asByteVector() -
asFloatVector
public float[] asFloatVector() -
addToBuffer
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceToXContent- Throws:
IOException
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
hashCode
public int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
parseXContent
- Throws:
IOException
-
fromFloats
-
fromBytes
-
floatVector
public float[] floatVector()Returns the value of thefloatVectorrecord component.- Returns:
- the value of the
floatVectorrecord component
-
byteVector
public byte[] byteVector()Returns the value of thebyteVectorrecord component.- Returns:
- the value of the
byteVectorrecord component
-