manticoresoftware / manticoresearch

Easy to use open source fast database for search | Good alternative to Elasticsearch now | Drop-in replacement for E in the ELK soon
https://manticoresearch.com
GNU General Public License v3.0
8.87k stars 490 forks source link

HNSW Support for Vector Search #1415

Closed loretoparisi closed 9 months ago

loretoparisi commented 1 year ago

Is your feature request related to a problem? Please describe. Indexing vectors of embeddings along with the document. Optionally supporto multi-vector per document and retrieval.

Describe the solution you'd like Add HNSW as vector similarity search

Describe alternatives you've considered

Additional context Semantic and Similarity Search integration to keyword based search.

sanikolaev commented 10 months ago

The following SQL syntax is proposed for the new field:

<field name> 
  float_vector 
    [knn_type='hnsw'
      knn_dims='int'
      knn_similarity={l2|ip|cosine}
      [hnsw_m='int']
      [hnsw_ef_construction='int']
    ]

Examples:

@glookka pls review and let me know if it looks good or if I'm missing something and there are better options.

glookka commented 10 months ago

knn_similarity={l2|ip|cosine} option is specific to HNSW. E.g. annoy has "angular", "euclidean", "manhattan", "hamming", or "dot". So it probably makes sense to name the option hnsw_similarity.

sanikolaev commented 9 months ago

Closing as done - https://manual.manticoresearch.com/dev/Searching/KNN#K-nearest-neighbor-search.