AI and LLMRetrieval

Vector Similarity Search

Find the nearest items by meaning, filtered by tag, inside the same engine that holds the items themselves.

indexed
HNSW
average search
O(log N)
distance metrics
3
Step 1 of 6
Create the index

Dimensions and metric are fixed per index. HNSW parameters can be tuned when needed.

Example sessionplaying
# Create the index
hotkv> VSIM.CREATEINDEX products 3 METRIC COSINE
OK

An animated walkthrough with real HotKV commands and example replies. Click any step to jump to it.

The problem

Semantic search, "more like this" and deduplication all come down to one question. Which stored items are closest to this one? Answering it usually means a dedicated vector database next to your main store, and every product update has to be written to both.

How HotKV handles it

HotKV keeps HNSW vector indexes in the engine. Product data lives in ordinary keys, the vectors are indexed under the same key names, and tags on those keys let a search stay inside a category or a tenant. One write path, one system to run.

Step by step

What happens, command by command

  1. 01

    Create the index

    Dimensions and metric are fixed per index. HNSW parameters can be tuned when needed.

    VSIM.CREATEINDEX products 3 METRIC COSINE
  2. 02

    Store the product

    The product's data is a normal hash, under the key name the index will use.

    HSET sku:1 name "Trail runner" price 89
  3. 03

    Tag it

    Tags on the key let a vector search stay inside a category.

    TAG.SET sku:1 shoes running
  4. 04

    Index its vector

    The vector goes into the index under the same key name.

    VSIM.SET products sku:1 0.12 0.80 0.31
  5. 05

    Search by meaning, within a tag

    The query text is embedded, and the nearest products that carry the tag come back with their distances.

    VSIM.SEARCH products 3 0.10 0.82 0.29 FILTER shoes
  6. 06

    Fetch what to show

    The results are key names, so the product data is one read away in the same server.

    HGETALL sku:1
Where it fits

Real-world scenarios

E-commerce search

Shoppers type what they want in their own words. The catalog is searched by meaning and filtered to the category and the shop they are in.

Duplicate detection

New support tickets or listings are compared with existing ones, and near duplicates are merged before a human sees them.

Image and media similarity

Embeddings from an image model find visually similar photos or clips across a library.

Built in

What you get

HNSW indexes

Approximate nearest-neighbour search that stays fast on large indexes, O(log N) on average.

VSIM.CREATEINDEXVSIM.SEARCH

Three metrics

Cosine, L2 and inner product, chosen per index.

METRIC

Tag filters

Restrict a search to keys that carry every given tag.

TAG.SETFILTER

Persistent

Indexes are kept in your snapshots and AOF rewrites like the rest of your data.

VSIM.INFO

Common questions

Does HotKV generate the embeddings?

No. Create vectors with the embedding model you prefer and store them with VSIM.SET.

How is this different from RAG pipelines?

VSIM is the general vector index. RAG pipelines build on the same idea and add chunking, metadata and hybrid keyword search for documents.

Which plans include it?

Vector search and tags are core commands and work on every plan, with no license needed.

Related use cases

Try it on your own workload

HotKV speaks the Redis protocol, so you can point an existing client at it and run these same commands.