Skip to content

Commit a94277f

Browse files
kotwanikunalkolchfa-awsnatebower
authored
Mark nmslib references for vector search as deprecated (#9107)
* Mark nmslib references for vector search as deprecated Signed-off-by: Kunal Kotwani <[email protected]> * Apply suggestions from code review Signed-off-by: kolchfa-aws <[email protected]> * Apply suggestions from code review Co-authored-by: Nathan Bower <[email protected]> Signed-off-by: kolchfa-aws <[email protected]> --------- Signed-off-by: Kunal Kotwani <[email protected]> Signed-off-by: kolchfa-aws <[email protected]> Co-authored-by: kolchfa-aws <[email protected]> Co-authored-by: Nathan Bower <[email protected]>
1 parent f8edf06 commit a94277f

File tree

8 files changed

+29
-29
lines changed

8 files changed

+29
-29
lines changed

_field-types/supported-field-types/knn-vector.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ Vector search involves trade-offs between low-latency and low-cost search. Speci
4848

4949
The following modes are currently supported.
5050

51-
| Mode | Default engine | Description |
51+
| Mode | Default engine | Description |
5252
|:---|:---|:---|
53-
| `in_memory` (Default) | `nmslib` | Prioritizes low-latency search. This mode uses the `nmslib` engine without any quantization applied. It is configured with the default parameter values for vector search in OpenSearch. |
53+
| `in_memory` (Default) | `faiss` | Prioritizes low-latency search. This mode uses the `faiss` engine without any quantization applied. It is configured with the default parameter values for vector search in OpenSearch. |
5454
| `on_disk` | `faiss` | Prioritizes low-cost vector search while maintaining strong recall. By default, the `on_disk` mode uses quantization and rescoring to execute a two-pass approach to retrieve the top neighbors. The `on_disk` mode supports only `float` vector types. |
5555

5656
To create a k-NN index that uses the `on_disk` mode for low-cost search, send the following request:
@@ -81,14 +81,14 @@ PUT test-index
8181

8282
The `compression_level` mapping parameter selects a quantization encoder that reduces vector memory consumption by the given factor. The following table lists the available `compression_level` values.
8383

84-
| Compression level | Supported engines |
85-
|:------------------|:-------------------------------|
86-
| `1x` | `faiss`, `lucene`, and `nmslib` |
87-
| `2x` | `faiss` |
88-
| `4x` | `lucene` |
89-
| `8x` | `faiss` |
90-
| `16x` | `faiss` |
91-
| `32x` | `faiss` |
84+
| Compression level | Supported engines |
85+
|:------------------|:---------------------------------------------|
86+
| `1x` | `faiss`, `lucene`, and `nmslib` (deprecated) |
87+
| `2x` | `faiss` |
88+
| `4x` | `lucene` |
89+
| `8x` | `faiss` |
90+
| `16x` | `faiss` |
91+
| `32x` | `faiss` |
9292

9393
For example, if a `compression_level` of `32x` is passed for a `float32` index of 768-dimensional vectors, the per-vector memory is reduced from `4 * 768 = 3072` bytes to `3072 / 32 = 846` bytes. Internally, binary quantization (which maps a `float` to a `bit`) may be used to achieve this compression.
9494

_ml-commons-plugin/remote-models/async-batch-ingestion.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ PUT /my-nlp-index
4949
"type": "knn_vector",
5050
"dimension": 384,
5151
"method": {
52-
"engine": "nmslib",
52+
"engine": "faiss",
5353
"space_type": "cosinesimil",
5454
"name": "hnsw",
5555
"parameters": {
@@ -65,7 +65,7 @@ PUT /my-nlp-index
6565
"type": "knn_vector",
6666
"dimension": 384,
6767
"method": {
68-
"engine": "nmslib",
68+
"engine": "faiss",
6969
"space_type": "cosinesimil",
7070
"name": "hnsw",
7171
"parameters": {

_search-plugins/knn/api.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,11 @@ For the warmup operation to function properly, follow these best practices:
173173
Introduced 2.14
174174
{: .label .label-purple }
175175

176-
During approximate k-NN search or warmup operations, the native library indexes (`nmslib` and `faiss` engines) are loaded into native memory. Currently, you can evict an index from cache or native memory by either deleting the index or setting the k-NN cluster settings `knn.cache.item.expiry.enabled` and `knn.cache.item.expiry.minutes`, which removes the index from the cache if it is idle for a given period of time. However, you cannot evict an index from the cache without deleting the index. To solve this problem, you can use the k-NN clear cache API operation, which clears a given set of indexes from the cache.
176+
During approximate k-NN search or warmup operations, the native library indexes (for the `faiss` and `nmslib` [deprecated] engines) are loaded into native memory. Currently, you can evict an index from the cache or native memory by either deleting the index or setting the k-NN cluster settings `knn.cache.item.expiry.enabled` and `knn.cache.item.expiry.minutes`, which removes the index from the cache if it is idle for a given period of time. However, you cannot evict an index from the cache without deleting the index. To solve this problem, you can use the k-NN clear cache API operation, which clears a given set of indexes from the cache.
177177

178178
The k-NN clear cache API evicts all native library files for all shards (primaries and replicas) of all indexes specified in the request. Similarly to how the [warmup operation](#warmup-operation) behaves, the k-NN clear cache API is idempotent, meaning that if you try to clear the cache for an index that has already been evicted from the cache, it does not have any additional effect.
179179

180-
This API operation only works with indexes created using the `nmslib` and `faiss` engines. It has no effect on indexes created using the `lucene` engine.
180+
This API operation only works with indexes created using the `faiss` and `nmslib` (deprecated) engines. It has no effect on indexes created using the `lucene` engine.
181181
{: .note}
182182

183183
#### Usage
@@ -236,7 +236,7 @@ Response field | Description
236236
`error` | An error message explaining why the model is in a failed state.
237237
`space_type` | The space type for which this model is trained, for example, Euclidean or cosine. Note - this value can be set in the top-level of the request as well
238238
`dimension` | The dimensionality of the vector space for which this model is designed.
239-
`engine` | The native library used to create the model, either `faiss` or `nmslib`.
239+
`engine` | The native library used to create the model, either `faiss` or `nmslib` (deprecated).
240240

241241
### Usage
242242

_search-plugins/knn/approximate-knn.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Because the native library indexes are constructed during indexing, it is not po
2424

2525
Each of the three engines used for approximate k-NN search has its own attributes that make one more sensible to use than the others in a given situation. You can follow the general information below to help determine which engine will best meet your requirements.
2626

27-
In general, nmslib outperforms both faiss and Lucene on search. However, to optimize for indexing throughput, faiss is a good option. For relatively smaller datasets (up to a few million vectors), the Lucene engine demonstrates better latencies and recall. At the same time, the size of the index is smallest compared to the other engines, which allows it to use smaller AWS instances for data nodes.
27+
In general, NMSLIB (deprecated) outperforms both Faiss and Lucene when used for search operations. However, to optimize for indexing throughput, Faiss is a good option. For relatively smaller datasets (up to a few million vectors), the Lucene engine demonstrates better latencies and recall. At the same time, the size of the index is smallest compared to the other engines, which allows it to use smaller AWS instances for data nodes.
2828

2929
When considering cluster node sizing, a general approach is to first establish an even distribution of the index across the cluster. However, there are other considerations. To help make these choices, you can refer to the OpenSearch managed service guidance in the section [Sizing domains](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/sizing-domains.html).
3030

@@ -33,7 +33,7 @@ When considering cluster node sizing, a general approach is to first establish a
3333
To use the k-NN plugin's approximate search functionality, you must first create a k-NN index with `index.knn` set to `true`. This setting tells the plugin to create native library indexes for the index.
3434

3535
Next, you must add one or more fields of the `knn_vector` data type. This example creates an index with two
36-
`knn_vector` fields, one using `faiss` and the other using `nmslib` fields:
36+
`knn_vector` fields, one using `faiss` and the other using `nmslib` (deprecated) fields:
3737

3838
```json
3939
PUT my-knn-index-1
@@ -52,7 +52,7 @@ PUT my-knn-index-1
5252
"space_type": "l2",
5353
"method": {
5454
"name": "hnsw",
55-
"engine": "nmslib",
55+
"engine": "faiss",
5656
"parameters": {
5757
"ef_construction": 128,
5858
"m": 24
@@ -294,7 +294,7 @@ The following table provides information about the `ef_search` parameter for the
294294

295295
Engine | Radial query support | Notes
296296
:--- | :--- | :---
297-
`nmslib` | No | If `ef_search` is present in a query, it overrides the `index.knn.algo_param.ef_search` index setting.
297+
`nmslib` (Deprecated) | No | If `ef_search` is present in a query, it overrides the `index.knn.algo_param.ef_search` index setting.
298298
`faiss` | Yes | If `ef_search` is present in a query, it overrides the `index.knn.algo_param.ef_search` index setting.
299299
`lucene` | No | When creating a search query, you must specify `k`. If you provide both `k` and `ef_search`, then the larger value is passed to the engine. If `ef_search` is larger than `k`, you can provide the `size` parameter to limit the final number of results to `k`.
300300

_search-plugins/knn/filter-search-knn.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ The following table summarizes the preceding filtering use cases.
2626
Filter | When the filter is applied | Type of search | Supported engines and methods | Where to place the `filter` clause
2727
:--- | :--- | :--- | :---
2828
Efficient k-NN filtering | During search (a hybrid of pre- and post-filtering) | Approximate | - `lucene` (`hnsw`) <br> - `faiss` (`hnsw`, `ivf`) | Inside the k-NN query clause.
29-
Boolean filter | After search (post-filtering) | Approximate | - `lucene`<br> - `nmslib`<br> - `faiss` | Outside the k-NN query clause. Must be a leaf clause.
30-
The `post_filter` parameter | After search (post-filtering) | Approximate | - `lucene`<br> - `nmslib`<br> - `faiss` | Outside the k-NN query clause.
29+
Boolean filter | After search (post-filtering) | Approximate | - `lucene` <br> - `faiss` <br> - `nmslib` (deprecated) | Outside the k-NN query clause. Must be a leaf clause.
30+
The `post_filter` parameter | After search (post-filtering) | Approximate | - `lucene`<br> - `nmslib` (deprecated) <br> - `faiss` | Outside the k-NN query clause.
3131
Scoring script filter | Before search (pre-filtering) | Exact | N/A | Inside the script score query clause.
3232

3333
## Filtered search optimization

_search-plugins/knn/knn-index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ Mapping parameter | Required | Default | Updatable | Description
9494
:--- | :--- | :--- | :--- | :---
9595
`name` | true | n/a | false | The identifier for the nearest neighbor method.
9696
`space_type` | false | l2 | false | The vector space used to calculate the distance between vectors. Note: This value can also be specified at the top level of the mapping.
97-
`engine` | false | faiss | false | The approximate k-NN library to use for indexing and search. The available libraries are `faiss`, `nmslib`, and `lucene`.
97+
`engine` | false | faiss | false | The approximate k-NN library to use for indexing and search. The available libraries are `faiss`, `lucene`, and `nmslib` (deprecated).
9898
`parameters` | false | null | false | The parameters used for the nearest neighbor method.
9999

100-
### Supported nmslib methods
100+
### Supported NMSLIB methods
101101

102102
Method name | Requires training | Supported spaces | Description
103103
:--- | :--- | :--- | :---
@@ -110,7 +110,7 @@ Parameter name | Required | Default | Updatable | Description
110110
`ef_construction` | false | 100 | false | The size of the dynamic list used during k-NN graph creation. Higher values result in a more accurate graph but slower indexing speed.
111111
`m` | false | 16 | false | The number of bidirectional links that the plugin creates for each new element. Increasing and decreasing this value can have a large impact on memory consumption. Keep this value between 2 and 100.
112112

113-
For nmslib, *ef_search* is set in the [index settings](#index-settings).
113+
For nmslib (deprecated), *ef_search* is set in the [index settings](#index-settings).
114114
{: .note}
115115

116116
An index created in OpenSearch version 2.11 or earlier will still use the old `ef_construction` value (`512`).
@@ -372,7 +372,7 @@ At the moment, several parameters defined in the settings are in the deprecation
372372
Setting | Default | Updatable | Description
373373
:--- | :--- | :--- | :---
374374
`index.knn` | false | false | Whether the index should build native library indexes for the `knn_vector` fields. If set to false, the `knn_vector` fields will be stored in doc values, but approximate k-NN search functionality will be disabled.
375-
`index.knn.algo_param.ef_search` | 100 | true | The size of the dynamic list used during k-NN searches. Higher values result in more accurate but slower searches. Only available for NMSLIB.
375+
`index.knn.algo_param.ef_search` (Deprecated) | 100 | true | The size of the dynamic list used during k-NN searches. Higher values result in more accurate but slower searches. Only available for NMSLIB.
376376
`index.knn.advanced.approximate_threshold` | 15,000 | true | The number of vectors a segment must have before creating specialized data structures for approximate search. Set to `-1` to disable building vector data structures and `0` to always build them.
377377
`index.knn.algo_param.ef_construction` | 100 | false | Deprecated in 1.0.0. Instead, use the [mapping parameters]({{site.url}}{{site.baseurl}}/search-plugins/knn/knn-index/#method-definitions) to set this value.
378378
`index.knn.algo_param.m` | 16 | false | Deprecated in 1.0.0. Use the [mapping parameters]({{site.url}}{{site.baseurl}}/search-plugins/knn/knn-index/#method-definitions) to set this value instead.

_search-plugins/knn/knn-vector-quantization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ has_math: true
99

1010
# k-NN vector quantization
1111

12-
By default, the k-NN plugin supports the indexing and querying of vectors of type `float`, where each dimension of the vector occupies 4 bytes of memory. For use cases that require ingestion on a large scale, keeping `float` vectors can be expensive because OpenSearch needs to construct, load, save, and search graphs (for native `nmslib` and `faiss` engines). To reduce the memory footprint, you can use vector quantization.
12+
By default, the k-NN plugin supports the indexing and querying of vectors of type `float`, where each dimension of the vector occupies 4 bytes of memory. For use cases that require ingestion on a large scale, keeping `float` vectors can be expensive because OpenSearch needs to construct, load, save, and search graphs (for the native `faiss` and `nmslib` [deprecated] engines). To reduce the memory footprint, you can use vector quantization.
1313

1414
OpenSearch supports many varieties of quantization. In general, the level of quantization will provide a trade-off between the accuracy of the nearest neighbor search and the size of the memory footprint consumed by the vector search. The supported types include byte vectors, 16-bit scalar quantization, product quantization (PQ), and binary quantization(BQ).
1515

_search-plugins/vector-search.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ PUT test-index
4040
"space_type": "l2",
4141
"method": {
4242
"name": "hnsw",
43-
"engine": "nmslib",
43+
"engine": "faiss",
4444
"parameters": {
4545
"ef_construction": 128,
4646
"m": 24
@@ -88,12 +88,12 @@ The following table lists the combinations of search methods and libraries suppo
8888

8989
Method | Engine
9090
:--- | :---
91-
HNSW | NMSLIB, Faiss, Lucene
91+
HNSW | Faiss, Lucene, NMSLIB (deprecated)
9292
IVF | Faiss
9393

9494
### Engine recommendations
9595

96-
In general, select NMSLIB or Faiss for large-scale use cases. Lucene is a good option for smaller deployments and offers benefits like smart filtering, where the optimal filtering strategy—pre-filtering, post-filtering, or exact k-NN—is automatically applied depending on the situation. The following table summarizes the differences between each option.
96+
In general, select Faiss for large-scale use cases. Lucene is a good option for smaller deployments and offers benefits like smart filtering, where the optimal filtering strategy—pre-filtering, post-filtering, or exact k-NN—is automatically applied depending on the situation. The following table summarizes the differences between each option.
9797

9898
| | NMSLIB/HNSW | Faiss/HNSW | Faiss/IVF | Lucene/HNSW |
9999
|:---|:---|:---|:---|:---|

0 commit comments

Comments
 (0)