spring-projects / spring-projects/spring-ai

Support Vector Databases Multiple indexes or collections

Open
#468 8 comments 19 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

design vector store
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 7h
Merged PRs (30d)
6

Description

Expected Behavior

I would like to be able to support multiple indexes or collections for vector data instead of being limited to configuring just one index. For example, in Redis or Qdrant implementations, it would be beneficial to have the ability to add vectors to different collections or indexes based on the business requirements.

An example method signature could be:

void add(List<Document> documents, String collectionName);

Current Behavior

https://github.com/spring-projects/spring-ai/blob/7634c6b78087a708a1dff8592b1485806da8ed4d/spring-ai-core/src/main/java/org/springframework/ai/vectorstore/VectorStore.java#L32-L73

Currently, the system only allows for configuring a single index or collection for storing vector data. This limitation restricts the flexibility and scalability of the system, especially when there is a need to store vectors in multiple separate collections or indexes.

Context

This feature request is essential for scenarios where there is a requirement to store and retrieve vector data from different collections or indexes based on specific use cases or business logic. Without the ability to support multiple indexes or collections, the current system falls short in meeting the diverse needs of various applications that rely on vector data storage.

I have considered the workaround of creating separate instances of the vector storage system for each collection needed, but this approach is not scalable and creates unnecessary complexity in managing multiple instances.

Having an add method that supports specifying the collection name or index where the documents should be added would greatly enhance the flexibility and usability of the system.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with spring-ai-core/src/main/java/org/springframework/ai/vectorstore/VectorStore.java, especially the API linked in the issue, then inspect the Redis and Qdrant implementations. Trace how the configured index or collection is selected and identify the affected callers and tests. Done means vector documents can be added to a caller-specified collection or index without breaking existing single-collection usage.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, redis, spring
Domain
backend-api-design, databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.