Skip to content

Commit

Permalink
Set default space type to L2 to support bwc (opensearch-project#267)
Browse files Browse the repository at this point in the history
This change adds L2 space type fall back during query.
This prevents backwards compatibility issues for clusters
upgrading from ES 7.1 and 7.4. In those versions, space
type was not introduced as a field attribute yet.

Signed-off-by: John Mazanec <[email protected]>
  • Loading branch information
jmazanec15 authored and martin-gaievski committed Mar 7, 2022
1 parent bc1a8a6 commit 3a164b7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/org/opensearch/knn/index/KNNWeight.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ public Scorer scorer(LeafReaderContext context) throws IOException {
} else {
String engineName = fieldInfo.attributes().getOrDefault(KNN_ENGINE, KNNEngine.NMSLIB.getName());
knnEngine = KNNEngine.getEngine(engineName);
spaceType = SpaceType.getSpace(fieldInfo.getAttribute(SPACE_TYPE));
String spaceTypeName = fieldInfo.attributes().getOrDefault(SPACE_TYPE, SpaceType.L2.getValue());
spaceType = SpaceType.getSpace(spaceTypeName);
}

/*
Expand Down

0 comments on commit 3a164b7

Please sign in to comment.