What are vector sets?
Vector sets are a Redis data type similar to sorted sets. However, instead of associating each element with a numerical score, elements in a vector set are associated with a vector—a list of floating-point numbers representing the item in a multi-dimensional space.
This makes vector sets ideal for similarity search tasks such as:
- Retrieving the most similar items to the vector of an existing element already in the set.
- Retrieving the most similar items to a specified vector (e.g., a new embedding not yet in the set).
With these capabilities, vector sets are useful in semantic search, recommendation systems, face recognition, and other applications where vector similarity is important.
A vector set is a collection of elements, each associated with a vector and optional custom attributes.
In above representation:
- Vector set key is "pg:sts"
- Element IDs are sentences identified by "s1", "s2", etc., each storing a vector and custom attributes required for future filtering or inspection.
Adding items to a vector set
You can add items to a vector set using the VADD command.
VADD
Parameters:
- {vectorSetKey} – The name of your vector set.
- {embeddingDimension} – The length of the vector (number of dimensions).
- {embeddingValues...} – The vector values (space-separated floats).
- {elementId} – A unique identifier for this element in the set.
- {elementAttributesAsJSON} – A JSON object containing any metadata about the element, making it easy to filter or inspect later.
Bulk data import (optional)
The full Semantic Textual Similarity (STS) Development Set used in this tutorial is available here.
Upload that file into Redis Insight:
- Click **Bulk Actions** -> choose **Upload Data** tab -> upload the file and click **Upload**

- Post upload, you can see the status of the upload data

Similarity search with existing elements
The VSIM command allows you to find elements in a vector set that are most similar to the vector of an existing element in the same set.
This is useful when you already have an element in your dataset and want to find others that are semantically or visually close to it.
VSIM
Parameters:
- {vectorSetKey} – The name of your vector set.
- ELE {elementId} – The ID of the element whose vector you want to use for similarity search.
- WITHSCORES – Returns the similarity score for each result.
- WITHATTRIBS – Returns the stored attributes (metadata) for each result.
Try in Redis sandbox
You can experiment with Element similarity queries in the Redis Sandbox:
- Element similarity with scores and count example

- Element similarity with logical filter

TIP
In the Redis sandbox, explore additional filter options in the left sidebar, including arithmetic filters, comparison filters, and containment filters.
Similarity search with specified vectors
The VSIM command can also search for elements similar to a vector you provide directly, instead of using an existing element’s vector.
This is useful when:
- You have a new piece of text, image, or audio not in your dataset.
- You have already generated its vector embeddings using the same model and dimensions used when seeding the vector set.
VSIM
Where:
- {vectorSetKey} – The name of your vector set.
- VALUES {embeddingDimension} {embeddingValues...} – The embedding vector to compare against.
- WITHSCORES – Returns the similarity score for each result.
- WITHATTRIBS – Returns the stored attributes (metadata) for each result.
- COUNT N (optional) – Limits the number of results returned.
NOTE
Before running this query, convert your search text into vector embeddings using the same model (and dimensionality) as the one used to seed the dataset. For example, if the dataset was built using OpenAI’s text-embedding-ada-002 model (1536 dimensions), use the same for the query.
Try in Redis sandbox
Experiment with Value similarity queries in the Redis Sandbox:
Value similarity with scores and count example

Value similarity with logical filter

TIP
In the Redis sandbox, explore additional filter options in the left sidebar, including arithmetic filters, comparison filters, and containment filters.
Other vector set commands
Vector sets in Redis support several utility commands that let you inspect, debug, and retrieve metadata, attributes, or structure-related information.
- **VCARD** – Count elements.
- **VDIM** – Get vector dimensions.
- **VEMB** – Get vector for an element.
- **VGETATTR** – Get attributes for an element.
- **VINFO** – Get metadata about the vector set.
- **VISMEMBER** – Check if an element exists.
- **VLINKS** – Get neighbors in the HNSW graph.
- **VRANDMEMBER** – Get random elements.
Commands
Try in Redis sandbox
Experiment with other vector set commands in the Redis sandbox:

TIP
In the Redis sandbox, you can select a command from the left sidebar, click the Run button, and instantly see the output.
Ready to use vector sets?
You’ve learned how to:
- Add elements to a vector set.
- Run similarity searches using existing or custom vectors.
- Use other utility commands to inspect and explore your data.
Vector sets provide fast, scalable similarity search in Redis — perfect for semantic search, recommendations, and AI-powered retrieval.
Next Steps:
- Try the Redis sandbox links in this guide.
- Import your own data and test queries.- Explore full docs: Vector sets data type
