public static class VectorField.Builder
extends java.lang.Object
Example usage:
VectorField field = VectorField.builder()
.fieldName("product_embedding")
.algorithm(VectorAlgorithm.HNSW)
.addAttribute("TYPE", "FLOAT32")
.addAttribute("DIM", 768)
.addAttribute("DISTANCE_METRIC", "COSINE")
.addAttribute("M", 32)
.addAttribute("EF_CONSTRUCTION", 200)
.build();
| Modifier and Type | Method and Description |
|---|---|
VectorField.Builder |
addAttribute(java.lang.String name,
java.lang.Object value)
Adds a single attribute to the vector field configuration.
|
VectorField.Builder |
algorithm(VectorField.VectorAlgorithm algorithm)
Sets the vector indexing algorithm to use.
|
VectorField.Builder |
as(java.lang.String attribute)
Sets an alias for the field that can be used in queries.
|
VectorField.Builder |
attributes(java.util.Map<java.lang.String,java.lang.Object> attributes)
Sets all vector field attributes at once, replacing any previously set attributes.
|
VectorField |
build()
Builds and returns a new VectorField instance with the configured properties.
|
VectorField.Builder |
fieldName(FieldName fieldName)
Sets the field name using a FieldName object.
|
VectorField.Builder |
fieldName(java.lang.String fieldName)
Sets the field name for the vector field.
|
public VectorField build()
java.lang.IllegalArgumentException - if required parameters (fieldName, algorithm, or attributes) are not setpublic VectorField.Builder fieldName(java.lang.String fieldName)
fieldName - the name of the vector field in the indexpublic VectorField.Builder fieldName(FieldName fieldName)
fieldName - the FieldName object containing the field name and optional aliaspublic VectorField.Builder as(java.lang.String attribute)
attribute - the alias name to use for this field in queriespublic VectorField.Builder algorithm(VectorField.VectorAlgorithm algorithm)
algorithm - the vector algorithm (FLAT, HNSW, or SVS_VAMANA)public VectorField.Builder attributes(java.util.Map<java.lang.String,java.lang.Object> attributes)
attributes - a map of attribute names to valuespublic VectorField.Builder addAttribute(java.lang.String name, java.lang.Object value)
name - the attribute namevalue - the attribute valueCopyright © 2025. All rights reserved.