Skip to content

Commit a060fc6

Browse files
remove unused setting ADVANCED_APPROXIMATE_THRESHOLD (#706)
* remove unused setting Signed-off-by: akash shankaran <akash.shankaran1@gmail.com> * remove unused setting Signed-off-by: akash shankaran <akash.shankaran1@gmail.com> --------- Signed-off-by: akash shankaran <akash.shankaran1@gmail.com>
1 parent 10538d6 commit a060fc6

6 files changed

Lines changed: 0 additions & 44 deletions

File tree

docs/user_guide.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,6 @@ For derived source configuration and version-specific behavior, see [docs/derive
10471047
| Setting | Default | Description |
10481048
|---|---|---|
10491049
| `index.knn` || Set to `true` to enable the KNN plugin on the index (required) |
1050-
| `index.knn.advanced.approximate_threshold` | `15000` | Minimum document count per segment before an approximate graph is built |
10511050
| `index.knn.disk.vector.shard_level_rescoring_disabled` | `false` | Disable shard-level re-scoring for on-disk vectors |
10521051
| `index.knn.derived_source.enabled` | `true` | Store vectors in derived source fields |
10531052

qa/restart-upgrade/src/test/java/org/opensearch/knn/bwc/IndexingIT.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ public void testKNNIndexDefaultLegacyFieldMapping() throws Exception {
4949
createKnnIndex(testIndex, getKNNDefaultIndexSettings(), createKnnIndexMapping(TEST_FIELD, DIMENSIONS));
5050
addKNNDocs(testIndex, TEST_FIELD, DIMENSIONS, DOC_ID, NUM_DOCS);
5151
} else {
52-
// update index setting to allow build graph always since we test graph count that are loaded into memory
53-
updateIndexSettings(testIndex, Settings.builder().put(KNNSettings.INDEX_KNN_ADVANCED_APPROXIMATE_THRESHOLD, 0));
5452
validateKNNIndexingOnUpgrade(NUM_DOCS);
5553
}
5654
}
@@ -246,9 +244,6 @@ public void testKNNIndexCustomLegacyFieldMapping() throws Exception {
246244
KNN_ALGO_PARAM_M_MIN_VALUE,
247245
KNN_ALGO_PARAM_EF_CONSTRUCTION_MIN_VALUE
248246
);
249-
if (isApproximateThresholdSupported(getBWCVersion())) {
250-
indexMappingSettings.put(KNNSettings.INDEX_KNN_ADVANCED_APPROXIMATE_THRESHOLD, 0);
251-
}
252247
createKnnIndex(testIndex, indexMappingSettings.build(), createKnnIndexMapping(TEST_FIELD, DIMENSIONS));
253248
addKNNDocs(testIndex, TEST_FIELD, DIMENSIONS, DOC_ID, NUM_DOCS);
254249
} else {
@@ -368,7 +363,6 @@ public void testNoParametersOnUpgrade() throws Exception {
368363

369364
// KNN indexing tests when the cluster is upgraded to latest version
370365
public void validateKNNIndexingOnUpgrade(int numOfDocs) throws Exception {
371-
updateIndexSettings(testIndex, Settings.builder().put(KNNSettings.INDEX_KNN_ADVANCED_APPROXIMATE_THRESHOLD, 0));
372366
forceMergeKnnIndex(testIndex);
373367
QUERY_COUNT = numOfDocs;
374368
validateKNNSearch(testIndex, TEST_FIELD, DIMENSIONS, QUERY_COUNT, K);

src/main/java/org/opensearch/knn/index/KNNSettings.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ public class KNNSettings {
6060
* Settings name
6161
*/
6262
public static final String KNN_SPACE_TYPE = "index.knn.space_type";
63-
public static final String INDEX_KNN_ADVANCED_APPROXIMATE_THRESHOLD = "index.knn.advanced.approximate_threshold";
6463
public static final String KNN_ALGO_PARAM_M = "index.knn.algo_param.m";
6564
public static final String KNN_ALGO_PARAM_EF_CONSTRUCTION = "index.knn.algo_param.ef_construction";
6665
public static final String KNN_ALGO_PARAM_EF_SEARCH = "index.knn.algo_param.ef_search";
@@ -94,10 +93,6 @@ public class KNNSettings {
9493
public static final boolean KNN_DEFAULT_FAISS_AVX512_DISABLED_VALUE = false;
9594
public static final boolean KNN_DEFAULT_FAISS_AVX512_SPR_DISABLED_VALUE = false;
9695
public static final String INDEX_KNN_DEFAULT_SPACE_TYPE = "l2";
97-
public static final Integer INDEX_KNN_ADVANCED_APPROXIMATE_THRESHOLD_DEFAULT_VALUE = 15_000;
98-
public static final Integer INDEX_KNN_BUILD_VECTOR_DATA_STRUCTURE_THRESHOLD_MIN = -1;
99-
public static final Integer INDEX_KNN_BUILD_VECTOR_DATA_STRUCTURE_THRESHOLD_MAX = Integer.MAX_VALUE - 2;
100-
public static final String INDEX_KNN_DEFAULT_SPACE_TYPE_FOR_BINARY = "hamming";
10196
public static final Integer INDEX_KNN_DEFAULT_ALGO_PARAM_M = 16;
10297
public static final Integer INDEX_KNN_DEFAULT_ALGO_PARAM_EF_SEARCH = 100;
10398
public static final Integer INDEX_KNN_DEFAULT_ALGO_PARAM_EF_CONSTRUCTION = 100;
@@ -156,21 +151,6 @@ public class KNNSettings {
156151
Setting.Property.Deprecated
157152
);
158153

159-
/**
160-
* build_vector_data_structure_threshold - This parameter determines when to build vector data structure for knn fields during indexing
161-
* and merging. Setting -1 (min) will skip building graph, whereas on any other values, the graph will be built if
162-
* number of live docs in segment is greater than this threshold. Since max number of documents in a segment can
163-
* be Integer.MAX_VALUE - 1, this setting will allow threshold to be up to 1 less than max number of documents in a segment
164-
*/
165-
public static final Setting<Integer> INDEX_KNN_ADVANCED_APPROXIMATE_THRESHOLD_SETTING = Setting.intSetting(
166-
INDEX_KNN_ADVANCED_APPROXIMATE_THRESHOLD,
167-
INDEX_KNN_ADVANCED_APPROXIMATE_THRESHOLD_DEFAULT_VALUE,
168-
INDEX_KNN_BUILD_VECTOR_DATA_STRUCTURE_THRESHOLD_MIN,
169-
INDEX_KNN_BUILD_VECTOR_DATA_STRUCTURE_THRESHOLD_MAX,
170-
IndexScope,
171-
Dynamic
172-
);
173-
174154
/**
175155
* M - the number of bi-directional links created for every new element during construction.
176156
* Reasonable range for M is 2-100. Higher M work better on datasets with high intrinsic
@@ -523,7 +503,6 @@ private Setting<?> getSetting(String key) {
523503
public List<Setting<?>> getSettings() {
524504
List<Setting<?>> settings = Arrays.asList(
525505
INDEX_KNN_SPACE_TYPE,
526-
INDEX_KNN_ADVANCED_APPROXIMATE_THRESHOLD_SETTING,
527506
INDEX_KNN_ALGO_PARAM_M_SETTING,
528507
INDEX_KNN_ALGO_PARAM_EF_CONSTRUCTION_SETTING,
529508
INDEX_KNN_ALGO_PARAM_EF_SEARCH_SETTING,

src/main/java/org/opensearch/knn/index/codec/BasePerFieldKnnVectorsFormat.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
import lombok.extern.log4j.Log4j2;
1010
import org.apache.lucene.codecs.KnnVectorsFormat;
1111
import org.apache.lucene.codecs.perfield.PerFieldKnnVectorsFormat;
12-
import org.opensearch.index.IndexSettings;
1312
import org.opensearch.index.mapper.MapperService;
14-
import org.opensearch.knn.index.KNNSettings;
1513
import org.opensearch.knn.index.codec.params.KNNScalarQuantizedVectorsFormatParams;
1614
import org.opensearch.knn.index.codec.params.KNNVectorsFormatParams;
1715
import org.opensearch.knn.index.engine.KNNEngine;
@@ -181,16 +179,6 @@ public KnnVectorsFormat getKnnVectorsFormatForField(final String field) {
181179
}
182180
}
183181

184-
private int getApproximateThresholdValue() {
185-
// This is private method and mapperService is already checked for null or valid instance type before this call
186-
// at caller, hence we don't need additional isPresent check here.
187-
final IndexSettings indexSettings = mapperService.get().getIndexSettings();
188-
final Integer approximateThresholdValue = indexSettings.getValue(KNNSettings.INDEX_KNN_ADVANCED_APPROXIMATE_THRESHOLD_SETTING);
189-
return approximateThresholdValue != null
190-
? approximateThresholdValue
191-
: KNNSettings.INDEX_KNN_ADVANCED_APPROXIMATE_THRESHOLD_DEFAULT_VALUE;
192-
}
193-
194182
@Override
195183
public int getMaxDimensions(String fieldName) {
196184
return getKnnVectorsFormatForField(fieldName).getMaxDimensions(fieldName);

src/test/java/org/opensearch/knn/recall/RecallTestsIT.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import static org.opensearch.knn.common.KNNConstants.PARAMETERS;
3838
import static org.opensearch.knn.common.KNNConstants.TYPE;
3939
import static org.opensearch.knn.common.KNNConstants.TYPE_KNN_VECTOR;
40-
import static org.opensearch.knn.index.KNNSettings.INDEX_KNN_ADVANCED_APPROXIMATE_THRESHOLD;
4140

4241
/**
4342
* Tests confirm that for the different supported configurations, recall is sound. The recall thresholds are
@@ -213,7 +212,6 @@ private Settings getSettings() {
213212
.put("number_of_shards", SHARD_COUNT)
214213
.put("number_of_replicas", REPLICA_COUNT)
215214
.put("index.knn", true)
216-
.put(INDEX_KNN_ADVANCED_APPROXIMATE_THRESHOLD, 0)
217215
.build();
218216
}
219217
}

src/testFixtures/java/org/opensearch/knn/KNNRestTestCase.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@
102102
import static org.opensearch.knn.TestUtils.computeGroundTruthValues;
103103

104104
import static org.opensearch.knn.common.KNNConstants.VECTOR_DATA_TYPE_FIELD;
105-
import static org.opensearch.knn.index.KNNSettings.INDEX_KNN_ADVANCED_APPROXIMATE_THRESHOLD;
106105
import static org.opensearch.knn.index.KNNSettings.KNN_INDEX;
107106
import static org.opensearch.knn.index.SpaceType.L2;
108107

@@ -1012,7 +1011,6 @@ protected Settings buildKNNIndexSettings(int approximateThreshold) {
10121011
.put("number_of_replicas", 0)
10131012
.put(KNN_INDEX, true)
10141013
// .put(KNNSettings.KNN_DERIVED_SOURCE_ENABLED, true)
1015-
.put(INDEX_KNN_ADVANCED_APPROXIMATE_THRESHOLD, approximateThreshold)
10161014
// .put("use_compound_file", false)
10171015
.build();
10181016
}

0 commit comments

Comments
 (0)