diff --git a/document/field_vector.go b/document/field_vector.go index 5b281ffad..1f67c8b16 100644 --- a/document/field_vector.go +++ b/document/field_vector.go @@ -42,7 +42,7 @@ type VectorField struct { value []float32 numPlainTextBytes uint64 - indextype string + indexOptimization string // Optimization applied to this index. } func (n *VectorField) Size() int { @@ -116,7 +116,7 @@ func NewVectorFieldWithIndexingOptions(name string, arrayPositions []uint64, options: options, value: vector, numPlainTextBytes: numBytesFloat32s(vector), - indextype: indexType, + indexOptimization: indexType, } } @@ -140,6 +140,6 @@ func (n *VectorField) Similarity() string { return n.similarity } -func (n *VectorField) IndexType() string { - return n.indextype +func (n *VectorField) IndexOptimization() string { + return n.indexOptimization } diff --git a/mapping/field.go b/mapping/field.go index 05719a7b8..9113af8e1 100644 --- a/mapping/field.go +++ b/mapping/field.go @@ -78,7 +78,8 @@ type FieldMapping struct { // See: index.DefaultSimilarityMetric & index.SupportedSimilarityMetrics Similarity string `json:"similarity,omitempty"` - VectorIndexType string `json:"vector_index_type,omitempty"` + // The type of index based on the parameter to optimize for. + VectorIndexType string `json:"vector_index_optimize_for,omitempty"` } // NewTextFieldMapping returns a default field mapping for text @@ -468,7 +469,7 @@ func (fm *FieldMapping) UnmarshalJSON(data []byte) error { if err != nil { return err } - case "vector_index_type": + case "vector_index_optimize_for": err := json.Unmarshal(v, &fm.VectorIndexType) if err != nil { return err diff --git a/mapping/mapping_vectors.go b/mapping/mapping_vectors.go index ac6c603c6..151cd8e45 100644 --- a/mapping/mapping_vectors.go +++ b/mapping/mapping_vectors.go @@ -163,7 +163,7 @@ func validateVectorFieldAlias(field *FieldMapping, parentName string, } if field.VectorIndexType == "" { - field.VectorIndexType = index.DefaultIndexType + field.VectorIndexType = index.DefaultIndexOptimization } // following fields are not applicable for vector @@ -206,10 +206,10 @@ func validateVectorFieldAlias(field *FieldMapping, parentName string, reflect.ValueOf(index.SupportedSimilarityMetrics).MapKeys()) } - if _, ok := index.SupportedIndexTunables[field.VectorIndexType]; !ok { + if _, ok := index.SupportedIndexConfigOptimizations[field.VectorIndexType]; !ok { return fmt.Errorf("field: '%s', invalid index optimisation "+ "tunable: '%s', valid values are: %+v", field.Name, field.VectorIndexType, - reflect.ValueOf(index.SupportedIndexTunables).MapKeys()) + reflect.ValueOf(index.SupportedIndexConfigOptimizations).MapKeys()) } if fieldAliasCtx != nil { // writing to a nil map is unsafe