Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions docs/user_guide/storing/index_hnswlib.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'. <br/><span style="color:black">**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)</span>. | '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).

Expand Down