diff --git a/docs/user_guide/storing/index_hnswlib.md b/docs/user_guide/storing/index_hnswlib.md index d873c059a57..d8f5ee633e8 100644 --- a/docs/user_guide/storing/index_hnswlib.md +++ b/docs/user_guide/storing/index_hnswlib.md @@ -123,16 +123,19 @@ In the example above you can see how to configure two different vector fields, w In this way, you can pass [all options that Hnswlib supports](https://github.com/nmslib/hnswlib#api-description): -| Keyword | Description | Default | -|-------------------|--------------------------------------------------------------------------------------------------------------------------------|---------| -| `max_elements` | Maximum number of vector that can be stored | 1024 | -| `space` | Vector space (similarity metric) the index operates in. Supports 'l2', 'ip', and 'cosine' | 'l2' | -| `index` | Whether or not an index should be built for this field. | True | -| `ef_construction` | defines a construction time/accuracy trade-off | 200 | -| `ef` | parameter controlling query time/accuracy trade-off | 10 | -| `M` | parameter that defines the maximum number of outgoing connections in the graph | 16 | -| `allow_replace_deleted` | enables replacing of deleted elements with new added ones | True | -| `num_threads` | sets the number of cpu threads to use | 1 | +| Keyword | Description | Default | +|-------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------| +| `max_elements` | Maximum number of vector that can be stored | 1024 | +| `space` | Vector space (distance metric) the index operates in. Supports 'l2', 'ip', and 'cosine'.
**Note:** In contrast to the other backends, for HnswDocumentIndex `'cosine'` refers to **cosine distance**, not cosine similarity. To transform one to the other, you can use: `cos_sim = 1 - cos_dist`. For more details see [here](https://en.wikipedia.org/wiki/Cosine_similarity#Cosine_Distance). | 'l2' | +| `index` | Whether or not an index should be built for this field. | True | +| `ef_construction` | defines a construction time/accuracy trade-off | 200 | +| `ef` | parameter controlling query time/accuracy trade-off | 10 | +| `M` | parameter that defines the maximum number of outgoing connections in the graph | 16 | +| `allow_replace_deleted` | enables replacing of deleted elements with new added ones | True | +| `num_threads` | sets the number of cpu threads to use | 1 | + +!!! note + In HnswLibDocIndex `space='cosine'` refers to cosine distance, not to cosine similarity, as it does for the other backends. You can find more details on the parameters [here](https://github.com/nmslib/hnswlib/blob/master/ALGO_PARAMS.md).