summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2020-03-20 14:53:49 +0000
committerArne Juul <arnej@verizonmedia.com>2020-03-23 14:30:35 +0000
commitb1324afaa4cb684862debfb97a492750960cd0cf (patch)
tree54736dbf9c186f15dd7c8ed80c0ff28f5cb090a7
parent4f29479b720958cba7e40e1142b379962f55c2e8 (diff)
make HNSW distance metric configurable
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/derived/AttributeFields.java2
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/document/HnswIndexParams.java46
-rw-r--r--config-model/src/main/javacc/SDParser.jj3
-rw-r--r--config-model/src/test/derived/advanced/attributes.cfg1
-rw-r--r--config-model/src/test/derived/array_of_struct_attribute/attributes.cfg2
-rw-r--r--config-model/src/test/derived/attributeprefetch/attributes.cfg18
-rw-r--r--config-model/src/test/derived/attributes/attributes.cfg18
-rw-r--r--config-model/src/test/derived/complex/attributes.cfg9
-rw-r--r--config-model/src/test/derived/hnsw_index/attributes.cfg1
-rw-r--r--config-model/src/test/derived/hnsw_index/test.sd1
-rw-r--r--config-model/src/test/derived/imported_position_field/attributes.cfg2
-rw-r--r--config-model/src/test/derived/imported_struct_fields/attributes.cfg8
-rw-r--r--config-model/src/test/derived/importedfields/attributes.cfg8
-rw-r--r--config-model/src/test/derived/inheritance/attributes.cfg3
-rw-r--r--config-model/src/test/derived/inheritfromparent/attributes.cfg1
-rw-r--r--config-model/src/test/derived/map_attribute/attributes.cfg3
-rw-r--r--config-model/src/test/derived/map_of_struct_attribute/attributes.cfg5
-rw-r--r--config-model/src/test/derived/music/attributes.cfg11
-rw-r--r--config-model/src/test/derived/newrank/attributes.cfg10
-rw-r--r--config-model/src/test/derived/predicate_attribute/attributes.cfg1
-rw-r--r--config-model/src/test/derived/prefixexactattribute/attributes.cfg2
-rw-r--r--config-model/src/test/derived/reference_fields/attributes.cfg3
-rw-r--r--config-model/src/test/derived/sorting/attributes.cfg3
-rw-r--r--config-model/src/test/derived/tensor/attributes.cfg5
-rw-r--r--config-model/src/test/derived/types/attributes.cfg13
-rw-r--r--configdefinitions/src/vespa/attributes.def1
26 files changed, 167 insertions, 13 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/derived/AttributeFields.java b/config-model/src/main/java/com/yahoo/searchdefinition/derived/AttributeFields.java
index 8de8b239c93..5b87fdcf5f6 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/derived/AttributeFields.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/derived/AttributeFields.java
@@ -246,6 +246,8 @@ public class AttributeFields extends Derived implements AttributesConfig.Produce
ib.hnsw.enabled(true);
ib.hnsw.maxlinkspernode(params.maxLinksPerNode());
ib.hnsw.neighborstoexploreatinsert(params.neighborsToExploreAtInsert());
+ var dm = AttributesConfig.Attribute.Index.Hnsw.Distancemetric.Enum.valueOf(params.distanceMetric().toString());
+ ib.hnsw.distancemetric(dm);
aaB.index(ib);
}
return aaB;
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/document/HnswIndexParams.java b/config-model/src/main/java/com/yahoo/searchdefinition/document/HnswIndexParams.java
index 70d0df8be7f..01434be8785 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/document/HnswIndexParams.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/document/HnswIndexParams.java
@@ -1,7 +1,8 @@
// Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.searchdefinition.document;
-import java.util.OptionalInt;
+import java.util.Locale;
+import java.util.Optional;
/**
* Configuration parameters for a hnsw index used together with a 1-dimensional indexed tensor for approximate nearest neighbor search.
@@ -12,33 +13,47 @@ public class HnswIndexParams {
public static final int DEFAULT_MAX_LINKS_PER_NODE = 16;
public static final int DEFAULT_NEIGHBORS_TO_EXPLORE_AT_INSERT = 200;
+ public static final DistanceMetric DEFAULT_DISTANCE_METRIC = DistanceMetric.EUCLIDEAN;
- private final OptionalInt maxLinksPerNode;
- private final OptionalInt neighborsToExploreAtInsert;
+ private final Optional<Integer> maxLinksPerNode;
+ private final Optional<Integer> neighborsToExploreAtInsert;
+ private final Optional<DistanceMetric> distanceMetric;
+
+ public static enum DistanceMetric { EUCLIDEAN, ANGULAR, GEODEGREES }
public static class Builder {
- private OptionalInt maxLinksPerNode = OptionalInt.empty();
- private OptionalInt neighborsToExploreAtInsert = OptionalInt.empty();
+ private Optional<Integer> maxLinksPerNode = Optional.empty();
+ private Optional<Integer> neighborsToExploreAtInsert = Optional.empty();
+ private Optional<DistanceMetric> distanceMetric = Optional.empty();
public void setMaxLinksPerNode(int value) {
- maxLinksPerNode = OptionalInt.of(value);
+ maxLinksPerNode = Optional.of(value);
}
public void setNeighborsToExploreAtInsert(int value) {
- neighborsToExploreAtInsert = OptionalInt.of(value);
+ neighborsToExploreAtInsert = Optional.of(value);
+ }
+ public void setDistanceMetric(String value) {
+ String upper = value.toUpperCase(Locale.ENGLISH);
+ DistanceMetric dm = DistanceMetric.valueOf(upper);
+ distanceMetric = Optional.of(dm);
}
public HnswIndexParams build() {
- return new HnswIndexParams(maxLinksPerNode, neighborsToExploreAtInsert);
+ return new HnswIndexParams(maxLinksPerNode, neighborsToExploreAtInsert, distanceMetric);
}
}
public HnswIndexParams() {
- this.maxLinksPerNode = OptionalInt.empty();
- this.neighborsToExploreAtInsert = OptionalInt.empty();
+ this.maxLinksPerNode = Optional.empty();
+ this.neighborsToExploreAtInsert = Optional.empty();
+ this.distanceMetric = Optional.empty();
}
- public HnswIndexParams(OptionalInt maxLinksPerNode, OptionalInt neighborsToExploreAtInsert) {
+ public HnswIndexParams(Optional<Integer> maxLinksPerNode,
+ Optional<Integer> neighborsToExploreAtInsert,
+ Optional<DistanceMetric> distanceMetric) {
this.maxLinksPerNode = maxLinksPerNode;
this.neighborsToExploreAtInsert = neighborsToExploreAtInsert;
+ this.distanceMetric = distanceMetric;
}
/**
@@ -46,8 +61,9 @@ public class HnswIndexParams {
* otherwise we use values from this.
*/
public HnswIndexParams overrideFrom(HnswIndexParams rhs) {
- return new HnswIndexParams(rhs.maxLinksPerNode.isPresent() ? rhs.maxLinksPerNode : maxLinksPerNode,
- rhs.neighborsToExploreAtInsert.isPresent() ? rhs.neighborsToExploreAtInsert : neighborsToExploreAtInsert);
+ return new HnswIndexParams(rhs.maxLinksPerNode.or(() -> maxLinksPerNode),
+ rhs.neighborsToExploreAtInsert.or(() -> neighborsToExploreAtInsert),
+ rhs.distanceMetric.or(() -> distanceMetric));
}
public int maxLinksPerNode() {
@@ -57,4 +73,8 @@ public class HnswIndexParams {
public int neighborsToExploreAtInsert() {
return neighborsToExploreAtInsert.orElse(DEFAULT_NEIGHBORS_TO_EXPLORE_AT_INSERT);
}
+
+ public DistanceMetric distanceMetric() {
+ return distanceMetric.orElse(DEFAULT_DISTANCE_METRIC);
+ }
}
diff --git a/config-model/src/main/javacc/SDParser.jj b/config-model/src/main/javacc/SDParser.jj
index 2ee0d870d0e..cca56c209c8 100644
--- a/config-model/src/main/javacc/SDParser.jj
+++ b/config-model/src/main/javacc/SDParser.jj
@@ -335,6 +335,7 @@ TOKEN :
| < ENABLE_BM25: "enable-bm25" >
| < HNSW: "hnsw" >
| < MAXLINKSPERNODE: "max-links-per-node" >
+| < DISTANCEMETRIC: "distance-metric" >
| < NEIGHBORSTOEXPLOREATINSERT: "neighbors-to-explore-at-insert" >
| < SUMMARYFEATURES_SL: "summary-features" (" ")* ":" (~["}","\n"])* ("\n")? >
| < SUMMARYFEATURES_ML: "summary-features" (<SEARCHLIB_SKIP>)? "{" (~["}"])* "}" >
@@ -1836,9 +1837,11 @@ void hnswIndex(IndexOperation index) :
void hnswIndexBody(HnswIndexParams.Builder params) :
{
int num;
+ String str;
}
{
( <MAXLINKSPERNODE> <COLON> num = integer() { params.setMaxLinksPerNode(num); }
+ | <DISTANCEMETRIC> <COLON> str = identifierWithDash() { params.setDistanceMetric(str); }
| <NEIGHBORSTOEXPLOREATINSERT> <COLON> num = integer() { params.setNeighborsToExploreAtInsert(num); } )
}
diff --git a/config-model/src/test/derived/advanced/attributes.cfg b/config-model/src/test/derived/advanced/attributes.cfg
index cf8644ebe83..0a76e44c4ac 100644
--- a/config-model/src/test/derived/advanced/attributes.cfg
+++ b/config-model/src/test/derived/advanced/attributes.cfg
@@ -21,4 +21,5 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
diff --git a/config-model/src/test/derived/array_of_struct_attribute/attributes.cfg b/config-model/src/test/derived/array_of_struct_attribute/attributes.cfg
index 29d5dd92043..006400c09d4 100644
--- a/config-model/src/test/derived/array_of_struct_attribute/attributes.cfg
+++ b/config-model/src/test/derived/array_of_struct_attribute/attributes.cfg
@@ -21,6 +21,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "elem_array.weight"
attribute[].datatype INT32
@@ -45,4 +46,5 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
diff --git a/config-model/src/test/derived/attributeprefetch/attributes.cfg b/config-model/src/test/derived/attributeprefetch/attributes.cfg
index 773f796ed59..cd91c15700b 100644
--- a/config-model/src/test/derived/attributeprefetch/attributes.cfg
+++ b/config-model/src/test/derived/attributeprefetch/attributes.cfg
@@ -21,6 +21,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "multibyte"
attribute[].datatype INT8
@@ -45,6 +46,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "wsbyte"
attribute[].datatype INT8
@@ -69,6 +71,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "singleint"
attribute[].datatype INT32
@@ -93,6 +96,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "multiint"
attribute[].datatype INT32
@@ -117,6 +121,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "wsint"
attribute[].datatype INT32
@@ -141,6 +146,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "singlelong"
attribute[].datatype INT64
@@ -165,6 +171,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "multilong"
attribute[].datatype INT64
@@ -189,6 +196,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "wslong"
attribute[].datatype INT64
@@ -213,6 +221,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "singlefloat"
attribute[].datatype FLOAT
@@ -237,6 +246,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "multifloat"
attribute[].datatype FLOAT
@@ -261,6 +271,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "wsfloat"
attribute[].datatype FLOAT
@@ -285,6 +296,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "singledouble"
attribute[].datatype DOUBLE
@@ -309,6 +321,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "multidouble"
attribute[].datatype DOUBLE
@@ -333,6 +346,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "wsdouble"
attribute[].datatype DOUBLE
@@ -357,6 +371,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "singlestring"
attribute[].datatype STRING
@@ -381,6 +396,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "multistring"
attribute[].datatype STRING
@@ -405,6 +421,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "wsstring"
attribute[].datatype STRING
@@ -429,4 +446,5 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
diff --git a/config-model/src/test/derived/attributes/attributes.cfg b/config-model/src/test/derived/attributes/attributes.cfg
index e3faf7662f4..29e4c209ef2 100644
--- a/config-model/src/test/derived/attributes/attributes.cfg
+++ b/config-model/src/test/derived/attributes/attributes.cfg
@@ -21,6 +21,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "a2"
attribute[].datatype STRING
@@ -45,6 +46,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "a3"
attribute[].datatype STRING
@@ -69,6 +71,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "a5"
attribute[].datatype STRING
@@ -93,6 +96,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "a6"
attribute[].datatype STRING
@@ -117,6 +121,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "b1"
attribute[].datatype STRING
@@ -141,6 +146,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "b2"
attribute[].datatype STRING
@@ -165,6 +171,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "b3"
attribute[].datatype STRING
@@ -189,6 +196,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "b4"
attribute[].datatype INT32
@@ -213,6 +221,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "b5"
attribute[].datatype INT32
@@ -237,6 +246,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "b6"
attribute[].datatype INT64
@@ -261,6 +271,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "b7"
attribute[].datatype DOUBLE
@@ -285,6 +296,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "a9"
attribute[].datatype INT32
@@ -309,6 +321,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "a10"
attribute[].datatype INT32
@@ -333,6 +346,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "a11"
attribute[].datatype INT32
@@ -357,6 +371,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "a12"
attribute[].datatype INT32
@@ -381,6 +396,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "a7_arr"
attribute[].datatype STRING
@@ -405,6 +421,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "a8_arr"
attribute[].datatype STRING
@@ -429,4 +446,5 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
diff --git a/config-model/src/test/derived/complex/attributes.cfg b/config-model/src/test/derived/complex/attributes.cfg
index b4971487bd1..5606e5ea730 100644
--- a/config-model/src/test/derived/complex/attributes.cfg
+++ b/config-model/src/test/derived/complex/attributes.cfg
@@ -21,6 +21,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "fleeting"
attribute[].datatype FLOAT
@@ -45,6 +46,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "fleeting2"
attribute[].datatype FLOAT
@@ -69,6 +71,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "foundat"
attribute[].datatype INT64
@@ -93,6 +96,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "collapseby"
attribute[].datatype INT32
@@ -117,6 +121,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "ts"
attribute[].datatype INT64
@@ -141,6 +146,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "combineda"
attribute[].datatype INT32
@@ -165,6 +171,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "year_arr"
attribute[].datatype INT32
@@ -189,6 +196,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "year_sub"
attribute[].datatype INT32
@@ -213,4 +221,5 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
diff --git a/config-model/src/test/derived/hnsw_index/attributes.cfg b/config-model/src/test/derived/hnsw_index/attributes.cfg
index 27c9f1e0d13..b61fd7e2ee5 100644
--- a/config-model/src/test/derived/hnsw_index/attributes.cfg
+++ b/config-model/src/test/derived/hnsw_index/attributes.cfg
@@ -21,4 +21,5 @@ attribute[].tensortype "tensor(x[128])"
attribute[].imported false
attribute[].index.hnsw.enabled true
attribute[].index.hnsw.maxlinkspernode 32
+attribute[].index.hnsw.distancemetric ANGULAR
attribute[].index.hnsw.neighborstoexploreatinsert 300
diff --git a/config-model/src/test/derived/hnsw_index/test.sd b/config-model/src/test/derived/hnsw_index/test.sd
index 03ede04208b..3b954e74fc5 100644
--- a/config-model/src/test/derived/hnsw_index/test.sd
+++ b/config-model/src/test/derived/hnsw_index/test.sd
@@ -5,6 +5,7 @@ search test {
index {
hnsw {
max-links-per-node: 32
+ distance-metric: angular
neighbors-to-explore-at-insert: 300
}
}
diff --git a/config-model/src/test/derived/imported_position_field/attributes.cfg b/config-model/src/test/derived/imported_position_field/attributes.cfg
index 5427e856df0..8f68068c8e7 100644
--- a/config-model/src/test/derived/imported_position_field/attributes.cfg
+++ b/config-model/src/test/derived/imported_position_field/attributes.cfg
@@ -21,6 +21,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "my_pos_zcurve"
attribute[].datatype INT64
@@ -45,4 +46,5 @@ attribute[].tensortype ""
attribute[].imported true
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
diff --git a/config-model/src/test/derived/imported_struct_fields/attributes.cfg b/config-model/src/test/derived/imported_struct_fields/attributes.cfg
index e1969e991dd..eb87c6cf53e 100644
--- a/config-model/src/test/derived/imported_struct_fields/attributes.cfg
+++ b/config-model/src/test/derived/imported_struct_fields/attributes.cfg
@@ -21,6 +21,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "my_elem_array.name"
attribute[].datatype STRING
@@ -45,6 +46,7 @@ attribute[].tensortype ""
attribute[].imported true
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "my_elem_array.weight"
attribute[].datatype INT32
@@ -69,6 +71,7 @@ attribute[].tensortype ""
attribute[].imported true
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "my_elem_map.key"
attribute[].datatype STRING
@@ -93,6 +96,7 @@ attribute[].tensortype ""
attribute[].imported true
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "my_elem_map.value.name"
attribute[].datatype STRING
@@ -117,6 +121,7 @@ attribute[].tensortype ""
attribute[].imported true
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "my_elem_map.value.weight"
attribute[].datatype INT32
@@ -141,6 +146,7 @@ attribute[].tensortype ""
attribute[].imported true
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "my_str_int_map.key"
attribute[].datatype STRING
@@ -165,6 +171,7 @@ attribute[].tensortype ""
attribute[].imported true
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "my_str_int_map.value"
attribute[].datatype INT32
@@ -189,4 +196,5 @@ attribute[].tensortype ""
attribute[].imported true
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
diff --git a/config-model/src/test/derived/importedfields/attributes.cfg b/config-model/src/test/derived/importedfields/attributes.cfg
index 168c9bd4659..d3a51523e05 100644
--- a/config-model/src/test/derived/importedfields/attributes.cfg
+++ b/config-model/src/test/derived/importedfields/attributes.cfg
@@ -21,6 +21,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "b_ref"
attribute[].datatype REFERENCE
@@ -45,6 +46,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "b_ref_with_summary"
attribute[].datatype REFERENCE
@@ -69,6 +71,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "my_int_field"
attribute[].datatype INT32
@@ -93,6 +96,7 @@ attribute[].tensortype ""
attribute[].imported true
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "my_string_field"
attribute[].datatype STRING
@@ -117,6 +121,7 @@ attribute[].tensortype ""
attribute[].imported true
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "my_int_array_field"
attribute[].datatype INT32
@@ -141,6 +146,7 @@ attribute[].tensortype ""
attribute[].imported true
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "my_int_wset_field"
attribute[].datatype INT32
@@ -165,6 +171,7 @@ attribute[].tensortype ""
attribute[].imported true
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "my_ancient_int_field"
attribute[].datatype INT32
@@ -189,4 +196,5 @@ attribute[].tensortype ""
attribute[].imported true
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
diff --git a/config-model/src/test/derived/inheritance/attributes.cfg b/config-model/src/test/derived/inheritance/attributes.cfg
index 05a980a8347..397d8878792 100644
--- a/config-model/src/test/derived/inheritance/attributes.cfg
+++ b/config-model/src/test/derived/inheritance/attributes.cfg
@@ -21,6 +21,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "overridden"
attribute[].datatype INT32
@@ -45,6 +46,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "onlymother"
attribute[].datatype STRING
@@ -69,4 +71,5 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
diff --git a/config-model/src/test/derived/inheritfromparent/attributes.cfg b/config-model/src/test/derived/inheritfromparent/attributes.cfg
index 9f01b6c45ce..3b30af10a8f 100644
--- a/config-model/src/test/derived/inheritfromparent/attributes.cfg
+++ b/config-model/src/test/derived/inheritfromparent/attributes.cfg
@@ -21,4 +21,5 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
diff --git a/config-model/src/test/derived/map_attribute/attributes.cfg b/config-model/src/test/derived/map_attribute/attributes.cfg
index 28cb551cced..4de78c52efd 100644
--- a/config-model/src/test/derived/map_attribute/attributes.cfg
+++ b/config-model/src/test/derived/map_attribute/attributes.cfg
@@ -21,6 +21,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "str_map.value"
attribute[].datatype STRING
@@ -45,6 +46,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "int_map.key"
attribute[].datatype INT32
@@ -69,4 +71,5 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
diff --git a/config-model/src/test/derived/map_of_struct_attribute/attributes.cfg b/config-model/src/test/derived/map_of_struct_attribute/attributes.cfg
index caae49a0252..72e60b857a2 100644
--- a/config-model/src/test/derived/map_of_struct_attribute/attributes.cfg
+++ b/config-model/src/test/derived/map_of_struct_attribute/attributes.cfg
@@ -21,6 +21,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "str_elem_map.value.name"
attribute[].datatype STRING
@@ -45,6 +46,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "str_elem_map.value.weight"
attribute[].datatype INT32
@@ -69,6 +71,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "int_elem_map.key"
attribute[].datatype INT32
@@ -93,6 +96,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "int_elem_map.value.name"
attribute[].datatype STRING
@@ -117,4 +121,5 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
diff --git a/config-model/src/test/derived/music/attributes.cfg b/config-model/src/test/derived/music/attributes.cfg
index a045a532965..4d19dc69b33 100644
--- a/config-model/src/test/derived/music/attributes.cfg
+++ b/config-model/src/test/derived/music/attributes.cfg
@@ -21,6 +21,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "pto"
attribute[].datatype INT32
@@ -45,6 +46,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "mid"
attribute[].datatype INT32
@@ -69,6 +71,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "weight"
attribute[].datatype FLOAT
@@ -93,6 +96,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "bgnpfrom"
attribute[].datatype FLOAT
@@ -117,6 +121,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "newestedition"
attribute[].datatype INT32
@@ -141,6 +146,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "year"
attribute[].datatype INT32
@@ -165,6 +171,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "did"
attribute[].datatype INT32
@@ -189,6 +196,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "cbid"
attribute[].datatype INT32
@@ -213,6 +221,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "hiphopvalue_arr"
attribute[].datatype STRING
@@ -237,6 +246,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "metalvalue_arr"
attribute[].datatype STRING
@@ -261,4 +271,5 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
diff --git a/config-model/src/test/derived/newrank/attributes.cfg b/config-model/src/test/derived/newrank/attributes.cfg
index f728b1b1d33..2aed2288773 100644
--- a/config-model/src/test/derived/newrank/attributes.cfg
+++ b/config-model/src/test/derived/newrank/attributes.cfg
@@ -21,6 +21,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "pto"
attribute[].datatype INT32
@@ -45,6 +46,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "mid"
attribute[].datatype INT32
@@ -69,6 +71,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "weight"
attribute[].datatype FLOAT
@@ -93,6 +96,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "bgnpfrom"
attribute[].datatype FLOAT
@@ -117,6 +121,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "newestedition"
attribute[].datatype INT32
@@ -141,6 +146,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "year"
attribute[].datatype INT32
@@ -165,6 +171,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "did"
attribute[].datatype INT32
@@ -189,6 +196,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "scorekey"
attribute[].datatype INT32
@@ -213,6 +221,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "cbid"
attribute[].datatype INT32
@@ -237,4 +246,5 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
diff --git a/config-model/src/test/derived/predicate_attribute/attributes.cfg b/config-model/src/test/derived/predicate_attribute/attributes.cfg
index 458ee86031d..3a9daf7af94 100644
--- a/config-model/src/test/derived/predicate_attribute/attributes.cfg
+++ b/config-model/src/test/derived/predicate_attribute/attributes.cfg
@@ -21,4 +21,5 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
diff --git a/config-model/src/test/derived/prefixexactattribute/attributes.cfg b/config-model/src/test/derived/prefixexactattribute/attributes.cfg
index 33fcecb1008..0a8cbd82186 100644
--- a/config-model/src/test/derived/prefixexactattribute/attributes.cfg
+++ b/config-model/src/test/derived/prefixexactattribute/attributes.cfg
@@ -21,6 +21,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "attributefield2"
attribute[].datatype STRING
@@ -45,4 +46,5 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
diff --git a/config-model/src/test/derived/reference_fields/attributes.cfg b/config-model/src/test/derived/reference_fields/attributes.cfg
index 58125f73f9c..e83b187a0cc 100644
--- a/config-model/src/test/derived/reference_fields/attributes.cfg
+++ b/config-model/src/test/derived/reference_fields/attributes.cfg
@@ -21,6 +21,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "other_ref"
attribute[].datatype REFERENCE
@@ -45,6 +46,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "yet_another_ref"
attribute[].datatype REFERENCE
@@ -69,4 +71,5 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
diff --git a/config-model/src/test/derived/sorting/attributes.cfg b/config-model/src/test/derived/sorting/attributes.cfg
index 3404d6a0384..83c310ca5ca 100644
--- a/config-model/src/test/derived/sorting/attributes.cfg
+++ b/config-model/src/test/derived/sorting/attributes.cfg
@@ -21,6 +21,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "syntaxcheck2"
attribute[].datatype STRING
@@ -45,6 +46,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "infieldonly"
attribute[].datatype STRING
@@ -69,4 +71,5 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
diff --git a/config-model/src/test/derived/tensor/attributes.cfg b/config-model/src/test/derived/tensor/attributes.cfg
index a8531f73c1e..780f47ee3d5 100644
--- a/config-model/src/test/derived/tensor/attributes.cfg
+++ b/config-model/src/test/derived/tensor/attributes.cfg
@@ -21,6 +21,7 @@ attribute[].tensortype "tensor<float>(x[2],y[1])"
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "f3"
attribute[].datatype TENSOR
@@ -45,6 +46,7 @@ attribute[].tensortype "tensor(x{})"
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "f4"
attribute[].datatype TENSOR
@@ -69,6 +71,7 @@ attribute[].tensortype "tensor(x[10],y[10])"
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "f5"
attribute[].datatype TENSOR
@@ -93,6 +96,7 @@ attribute[].tensortype "tensor<float>(x[10])"
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "f6"
attribute[].datatype FLOAT
@@ -117,4 +121,5 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
diff --git a/config-model/src/test/derived/types/attributes.cfg b/config-model/src/test/derived/types/attributes.cfg
index 290dd5b9a8b..82535324864 100644
--- a/config-model/src/test/derived/types/attributes.cfg
+++ b/config-model/src/test/derived/types/attributes.cfg
@@ -21,6 +21,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "along"
attribute[].datatype INT64
@@ -45,6 +46,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "abool"
attribute[].datatype BOOL
@@ -69,6 +71,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "ashortfloat"
attribute[].datatype FLOAT16
@@ -93,6 +96,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "arrayfield"
attribute[].datatype INT32
@@ -117,6 +121,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "setfield"
attribute[].datatype STRING
@@ -141,6 +146,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "setfield2"
attribute[].datatype STRING
@@ -165,6 +171,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "setfield3"
attribute[].datatype STRING
@@ -189,6 +196,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "setfield4"
attribute[].datatype STRING
@@ -213,6 +221,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "tagfield"
attribute[].datatype STRING
@@ -237,6 +246,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "juletre"
attribute[].datatype INT64
@@ -261,6 +271,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "album1"
attribute[].datatype STRING
@@ -285,6 +296,7 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
attribute[].name "other"
attribute[].datatype INT64
@@ -309,4 +321,5 @@ attribute[].tensortype ""
attribute[].imported false
attribute[].index.hnsw.enabled false
attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.distancemetric EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert 200
diff --git a/configdefinitions/src/vespa/attributes.def b/configdefinitions/src/vespa/attributes.def
index eb7dad88995..604ddd40930 100644
--- a/configdefinitions/src/vespa/attributes.def
+++ b/configdefinitions/src/vespa/attributes.def
@@ -34,4 +34,5 @@ attribute[].imported bool default=false
# Configuration parameters for a hnsw index used together with a 1-dimensional indexed tensor for approximate nearest neighbor search.
attribute[].index.hnsw.enabled bool default=false
attribute[].index.hnsw.maxlinkspernode int default=16
+attribute[].index.hnsw.distancemetric enum { EUCLIDEAN, ANGULAR, GEODEGREES } default=EUCLIDEAN
attribute[].index.hnsw.neighborstoexploreatinsert int default=200