Skip to content

Commit

Permalink
Create legacy mapping only up to V_2_17_2
Browse files Browse the repository at this point in the history
Signed-off-by: Vijayan Balasubramanian <[email protected]>
  • Loading branch information
VijayanB committed Oct 23, 2024
1 parent aa3eb33 commit 750ba91
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public KNNEngine resolveEngine(

// For 1x, we need to default to faiss if mode is provided and use nmslib otherwise
if (CompressionLevel.isConfigured(compressionLevel) == false || compressionLevel == CompressionLevel.x1) {
return mode == Mode.ON_DISK ? KNNEngine.FAISS : KNNEngine.DEFAULT;
return mode == Mode.ON_DISK ? KNNEngine.FAISS : KNNEngine.NMSLIB;
}

// Lucene is only engine that supports 4x - so we have to default to it here.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,9 @@ private void resolveKNNMethodComponents(
.build()
);

// If the original parameters are from legacy
if (builder.originalParameters.isLegacyMapping()) {
// If the original parameters are from legacy, and it is created on or before 2_17_2 since default is changed to
// FAISS starting 2_18, which doesn't support accepting algo params from index settings
if (parserContext.indexVersionCreated().onOrBefore(Version.V_2_17_2) && builder.originalParameters.isLegacyMapping()) {
// Then create KNNMethodContext to be used from the legacy index settings
builder.originalParameters.setResolvedKnnMethodContext(
createKNNMethodContextFromLegacy(parserContext.getSettings(), parserContext.indexVersionCreated(), resolvedSpaceType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ static KNNMethodContext createKNNMethodContextFromLegacy(
? topLevelSpaceType
: KNNVectorFieldMapperUtil.getSpaceType(indexSettings);
return new KNNMethodContext(
KNNEngine.DEFAULT,
KNNEngine.NMSLIB,
finalSpaceToSet,
new MethodComponentContext(
METHOD_HNSW,
Expand Down

0 comments on commit 750ba91

Please sign in to comment.