Please do a quick search on GitHub issues first, there might be already a duplicate issue for the one you are about to create. If the bug is trivial, just go ahead and create the issue. Otherwise, please take a few moments and fill in the following sections:

Bug description

Image

Environment 17 17 17 6.2.4 3.4.3 1.0.0-M6 2024.0.0 1.18.34 Steps to reproduce

RedisVectorStore redisVectorStore = RedisVectorStore.builder(jedisPooled, embeddingModel)
                .initializeSchema(true)
                .metadataFields(RedisVectorStore.MetadataField.numeric("id")
                        ,RedisVectorStore.MetadataField.tag("type"))
                .observationRegistry(observationRegistry.getIfUnique(() -> ObservationRegistry.NOOP))
                .customObservationConvention(customObservationConvention.getIfAvailable(() -> null))
                .batchingStrategy(batchingStrategy)
                .batchingStrategy(new TokenCountBatchingStrategy())
                .indexName(properties.getIndex())
                .prefix(properties.getPrefix())
                .build();

        redisVectorStore.add(Arrays.asList(new Document("A", Map.of("type", "B"))));

        SearchRequest searchRequest = SearchRequest.builder()
                .query("A")
                .filterExpression("type == 'B'")
                .build();
        List<Document> documents = redisVectorStore.doSimilaritySearch(searchRequest);

} Expected behavior A clear and concise description of what you expected to happen.

Minimal Complete Reproducible example Please provide a failing test or a minimal complete verifiable example that reproduces the issue. Bug reports that are reproducible will take priority in resolution over reports that are not reproducible.

Comment From: dev-jonghoonpark

Does the issue you’re experiencing match the following description?


You added a text A with metadata {"type": "B"} to a Redis vector store.

Then, you created a SearchRequest and ran a doSimilaritySearch, but nothing came back.

Comment From: 799452017

Does the issue you’re experiencing match the following description?

You added a text A with metadata {"type": "B"} to a Redis vector store.

Then, you created a SearchRequest and ran a doSimilaritySearch, but nothing came back.

Yes, I'm sorry I didn't describe it clearly. Can you help me answer him?

Comment From: dev-jonghoonpark

I encountered the same issue and made several attempts to identify the exact cause, but I couldn't pinpoint it.

In my case, the issue was resolved when I changed the Redis port from the default 6379 to 6380, although I’m not entirely sure why. Even after multiple retries and reboots, 6379 consistently returned an empty list, while 6380 worked perfectly fine.

The reason I decided to try changing the port was that the test code was functioning without any issues. Since the test code uses a random port, I configured it to use a different port as well, and I confirmed that it worked as expected.

Comment From: kevindai007

I encountered the same issue, and it doesn't work for me even after changing the port to 6380. Actually this issue occurs when trying to query with metadata

The result of the following code is empty

FilterExpressionBuilder b = new FilterExpressionBuilder();
        Filter.Expression expression = b.eq("message_type", messageType).build();
        List<Document> results = this.vectorStore.similaritySearch(SearchRequest.builder().query(input).filterExpression(expression).topK(5).build());

But I can get result like this

        List<Document> results = this.vectorStore.similaritySearch(SearchRequest.builder().query(input).topK(5).build());

And I found the metadata in the result is incorrect Image

here is my data in redis:

Image

Comment From: chenm202501

I encountered the same issue, and it doesn't work for me even after changing the port to 6380. Actually this issue occurs when trying to query with metadata

The result of the following code is empty

FilterExpressionBuilder b = new FilterExpressionBuilder(); Filter.Expression expression = b.eq("message_type", messageType).build(); List<Document> results = this.vectorStore.similaritySearch(SearchRequest.builder().query(input).filterExpression(expression).topK(5).build());

But I can get result like this

List<Document> results = this.vectorStore.similaritySearch(SearchRequest.builder().query(input).topK(5).build());

And I found the metadata in the result is incorrect

here is my data in redis:

I encountered the same issue too.

Comment From: RTException

I encountered the same issue. After adding the metadata filter condition, the result is empty. I checked RedisVectorStoreAutoConfiguration.java and found that metadataFields is not automatically configured. I hope that in future versions, it will be possible to configure metadataFields through application.yml.