Skip to content
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

### Bug Fixes
* Fix score conversion logic for radial exact search [#3110](https://github.com/opensearch-project/k-NN/pull/3110)
* Adjusting the merge policy setting to make merges less aggressive [#3128](https://github.com/opensearch-project/k-NN/pull/3128)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should move this to enhancement section


### Refactoring

Expand Down
12 changes: 11 additions & 1 deletion src/main/java/org/opensearch/knn/plugin/KNNPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import org.opensearch.core.action.ActionResponse;
import org.opensearch.core.common.io.stream.NamedWriteableRegistry;
import org.opensearch.core.common.settings.SecureString;
import org.opensearch.core.common.unit.ByteSizeUnit;
import org.opensearch.core.common.unit.ByteSizeValue;
import org.opensearch.core.xcontent.NamedXContentRegistry;
import org.opensearch.env.Environment;
import org.opensearch.env.NodeEnvironment;
Expand Down Expand Up @@ -284,7 +286,15 @@ public Collection<IndexSettingProvider> getAdditionalIndexSettingProviders() {
@Override
public Settings getAdditionalIndexSettings(String indexName, boolean isDataStreamIndex, Settings templateAndRequestSettings) {
if (templateAndRequestSettings.getAsBoolean(KNNSettings.KNN_INDEX, false)) {
return Settings.builder().put(KNN_DERIVED_SOURCE_ENABLED, true).build();
return Settings.builder()
.put(KNN_DERIVED_SOURCE_ENABLED, true)
// Aggressive merges for k-NN can hogg CPU which can degrade search performance
// These settings are being overridden to make it less aggressive
// Core has max_merge_at_once default as 30, which can make merges more aggressive
.put("index.merge.policy.max_merge_at_once", 10)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also lets have a IT to validate that index settings are getting set with correct values for index.knn true and false

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

// Core has max_merge_at_once default as 16MB, which can make merges more aggressive
.put("index.merge.policy.floor_segment", new ByteSizeValue(2, ByteSizeUnit.MB))
.build();
}
return Settings.EMPTY;
}
Expand Down
Loading