-
Notifications
You must be signed in to change notification settings - Fork 677
Spring Data 2025.0 Release Notes
-
Vector
abstraction to represent AI embeddings
Details
-
Spring Data Build - 3.5
After introducing support for Value Expressions, we now no longer require components that only support SpEL without following the newly introduced Value Expressions API. Therefore, we’re deprecating QueryMethodEvaluationContextProvider
(and its reactive variants), and SpelEvaluator
for removal in the next major release.
Please migrate off this API towards their Value Expression replacements.
A growing number of databases have support for vector data mainly in the form of an array of floating-point numbers or quantized int8 (8-bit-integer). The newly introduced Vector
type allows abstracting the underlying values within the domain model to simplify declaration, portability, and default storage options.
class Article {
Vector embedding;
}
Article article = new Article();
article.setEmbedding(Vector.of(model.getVectorOutput()));
MongoDB Vector Search uses a $vectorSearch
aggregation stage to run queries against specialized indexes that can be created using the new
VectorIndex
via SearchIndexOperations
. The VectorSearchOperation
can be part of an aggregation pipeline to do similarity search against vector data.
VectorIndex index = new VectorIndex("vector_index")
.addVector("embedding"), vector -> vector.dimensions(1536).similarity(COSINE))
.addFilter("year");
mongoTemplate.searchIndexOps(Movie.class)
.createIndex(index);
// ...
VectorSearchOperation search = VectorSearchOperation.search("vector_index")
.path("embedding")
.vector( ... )
.numCandidates(150)
.limit(10)
.quantization(SCALAR)
.withSearchScore("score");
AggregationResults<MovieWithSearchScore> results = mongoTemplate
.aggregate(newAggregation(Movie.class, search), MovieWithSearchScore.class);
We’ve upgraded the Cassandra driver to version 4.19 and we’re building against Cassandra 5.0.
Spring Data Cassandra ships with support for Storage-Attached Indexes. Specifically, we provide programmatic interfaces to specify and generate CQL for CREATE INDEX … USING 'sai'
and the @SaiIndexed
annotation for text and vector index definitions.
With introducing the Spring Data Vector
type, we now allow using vector data types in mapped entities. We support both, Cassandra’s CqlVector
and our Vector
type to insert and query for vector data. Cassandra uses vectors in queries for similarity and ordering.
@Table
class CommentSearch {
String comment;
float similarity;
}
@Table
class Comments {
@Id UUID id;
String comment;
@VectorType(dimensions = 5)
@SaiIndexed Vector vector;
}
Vector vector = Vector.of(/* from your Embedding */);
Columns columns = Columns.empty().include("comment").select("vector",
it -> it.similarity(vector).cosine().as("similarity"));
Query query = Query.select(columns).limit(3).sort(VectorSort.ann("vector", vector));
List<CommentSearch> result = template.query(Comments.class).as(CommentSearch.class).matching(query).all();
Map-based repositories now support Not
, NotIn
, and NotLike
keywords when using query derivation.
interface PersonRepository extends Repository<Person, String> {
Person findByFirstnameNot(String firstname);
Person findByFirstnameNotLike(String firstname);
Person findByFirstnameNotIn(List<String> in);
}
-
M1 - Feb 14, 2025
-
RC - April 11, 2025
-
GA - May 16, 2025
-
OSS Support until: May 2026
-
End of Life: Sept 2027