spring-projects / spring-projects/spring-ai

Add Amazon ElastiCache / Valkey as a Vector Store

Open
#5,215 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 7h
Merged PRs (30d)
6

Description

Expected Behavior

Valkey/ElastiCache should be usable as a VectorStore for RAG applications, semantic search, and semantic caching using the official Valkey Glide Java client. I am willing to contribute this implementation.

// wiring example
@Bean
public GlideClient glideClient() {
    return GlideClient.createClient(/* config */).get();
}

@Bean
public VectorStore vectorStore(GlideClient glideClient, EmbeddingModel embeddingModel) {
    return ValkeyVectorStore.builder(glideClient, embeddingModel)
        .indexName("spring-ai-index")
        .build();
}

// usage example
@Configuration
public class ValkeyConfig {

    @Bean
    public ValkeyVectorStore vectorStore(
        @Value("${spring.ai.valkey.endpoint}") String endpoint,
        EmbeddingModel embeddingModel) {

        return new ValkeyVectorStore(endpoint, embeddingModel);
    }
}

@Service
public class DocumentService {

    @Autowired
    private ValkeyVectorStore vectorStore;

    public List<Document> search(String query) {
        // Semantic search with metadata filtering
        SearchRequest request = SearchRequest.query(query)
            .withTopK(5)
            .withSimilarityThreshold(0.7)
            .withFilterExpression("source == 'docs' && year >= 2024");

        return vectorStore.similaritySearch(request);
    }
}

The implementation would use:

  • FT.CREATE / FT.SEARCH commands for vector indexing and search
  • HNSW and FLAT vector indexing algorithms
  • TAG, NUMERIC field types for metadata filtering

Current Behavior

Spring AI supports Redis as a VectorStore using the Jedis client. While Valkey is Redis-compatible at the protocol level (RESP), there is no integration using the official Valkey Glide client.

Key differeces that justify a separate implementation:

  • Different client library: Glide has a fundamentally different architecture (async Rust core with Java bidnings) compared to Jedis (pure Java)
  • Native cluster support: Glide provides transparent request routing for ElastiCache cluster deployments
  • AWS-maintained: Glide is the official client for ElastiCache/Valkey, actively maintained by AWS

Context

Valkey is an open-source, Redis-compatible in-memory data store. Amazon ElastiCache offers Valkey as a managed service. Both support vector similarity search.

This feature would benefit users who:

  • Use Amazon ElastiCache with Valkey
  • Want to use the official AWS-maintained Glide client
  • Need sub-millisecond query latency for RAG applications and semantic caching

The existing spring-ai-redis-store with Jedis could be used as a workaround since Valkey is protocol-compatible, but this misses the benefits of the purpose-built Glide client.

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 by reading spring-ai-redis-store/src/main/java/org/springframework/ai/vectorstore/redis/RedisVectorStore.java and the Valkey Glide Java client documentation linked in the issue. Define the integration around FT.CREATE and FT.SEARCH, supporting HNSW and FLAT indexes plus TAG and NUMERIC metadata filters; done means Valkey/ElastiCache can provide the VectorStore behavior described for RAG and semantic search.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, java
Domain
ai, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.