Skip to content

Commit

Permalink
Set default space type to L2 to support bwc
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.
  • Loading branch information
jmazanec15 committed Jan 24, 2022
1 parent b01b79b commit 9884724
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 9884724

Please sign in to comment.