KnnFloatVectorField

constructor(name: String, vector: FloatArray, similarityFunction: VectorSimilarityFunction)

Creates a numeric vector field. Fields are single-valued: each document has either one value or no value. Vectors of a single field share the same dimension and similarity function. Note that some vector similarities (like VectorSimilarityFunction.DOT_PRODUCT) require values to be unit-length, which can be enforced using VectorUtil.l2normalize.

Parameters

name

field name

vector

value

similarityFunction

a function defining vector proximity.

Throws

if any parameter is null, or the vector is empty or has dimension > 1024.


constructor(name: String, vector: FloatArray)

Creates a numeric vector field with the default EUCLIDEAN_HNSW (L2) similarity. Fields are single-valued: each document has either one value or no value. Vectors of a single field share the same dimension and similarity function.

Parameters

name

field name

vector

value

Throws

if any parameter is null, or the vector is empty or has dimension > 1024.


constructor(name: String, vector: FloatArray, fieldType: FieldType)

Creates a numeric vector field. Fields are single-valued: each document has either one value or no value. Vectors of a single field share the same dimension and similarity function.

Parameters

name

field name

vector

value

fieldType

field type

Throws

if any parameter is null, or the vector is empty or has dimension > 1024.