# Spring AI 2.1.0 PgVectorStore on the same database (hash-based stand-in embeddings, 32 dimensions) # Hibernate ORM 7.4.17.Final (on the classpath), PostgreSQL 16.15, pgvector 0.8.7, JDK 25 == 1. What the store created by itself id uuid content text metadata json embedding vector(32) CREATE INDEX spring_ai_vector_index ON public.vector_store USING hnsw (embedding vector_cosine_ops) CREATE UNIQUE INDEX vector_store_pkey ON public.vector_store USING btree (id) == 2. similaritySearch(query = 'vector search with Hibernate and Spring Data', topK = 3) 0.5241 IN Spring Data JPA can run vector search methods that return SearchResults 0.5051 IN Hibernate maps float arrays to pgvector columns with hibernate-vector 0.5040 US Sourdough starter needs flour water and patience == 3. The same search with filterExpression("country == 'US'") 0.5040 US Sourdough starter needs flour water and patience 0.1336 US HNSW indexes in PostgreSQL trade recall for speed == 4. The SQL PostgreSQL ran for the filtered search (auto_explain) SELECT *, embedding <=> $1 AS distance FROM public.vector_store WHERE embedding <=> $2 < $3 AND metadata::jsonb @@ '$."country" == "US"'::jsonpath ORDER BY distance LIMIT $4