Press Release: CORTO’s billion-scale legal semantic search with Aurora PostgreSQL pgvector

When a legal team needs to find the right precedent, relevant clause, or key fact across decades of case files, every hour saved through semantic search is several hours reclaimed for strategic counsel and client service. CORTO’s AI-powered semantic search gives legal teams their time back, returning instant, accurate results from billions of documents using Amazon Aurora PostgreSQL and pgvector optimized for billion-scale vector search.

CORTO is an AI-powered legal technology platform serving 10,000+ law firms globally. It makes 2.5 billion documents spanning decades of legal knowledge instantly searchable through a production system managing 7.6 billion vectors in a 46 TB Aurora PostgreSQL cluster. CORTO chose Aurora PostgreSQL with pgvector over purpose-built vector databases, migrated to compact embeddings, and implemented multi-tenant partitioning with logical per-firm isolation. These decisions reduced storage costs while maintaining sub-second query performance. Using existing PostgreSQL expertise, CORTO transformed how legal teams access decades of precedent.

In this post, we describe how CORTO built and scaled this system, from the decision to use Aurora PostgreSQL with pgvector over purpose-built vector databases, through the embedding model strategy that drives cost and performance optimization, to the multi-tenant design that maintains logical data isolation across thousands of firms, and the operational insights gained at production scale.

Law firms accumulate decades of legal knowledge, from case precedents and contracts to opinions and filings, that legal teams must search and apply in near real time. CORTO set out to solve this at scale, with four core requirements:

  1. Legacy data accessibility: Make decades of legal documents instantly searchable through AI-powered semantic search.
  2. Multi-tenant architecture: Serve law firms with tenant isolation and compliance requirements.
  3. Cost-efficient scale: Handle billions of documents while maintaining sustainable economics.
  4. Near real-time performance: Support near real-time document ingestion and semantic search.

In 2023, the managed AI landscape was still early. Amazon Bedrock was in preview, and production-scale vector search patterns were not yet widely documented. Adopting a dedicated vector database would have meant asking CORTO’s team to learn an entirely new system from scratch, at the same time as building the application on top of it.

CORTO needed to reach production quickly, on infrastructure their engineering team already knew how to operate, while meeting a 99.99 percent availability service level agreement (SLA) and legal industry compliance requirements from day one.

Why Aurora PostgreSQL and pgvector?

CORTO’s engineering team evaluated multiple vector database options before selecting Aurora PostgreSQL with pgvector. The decision came down to two practical advantages:

First, the team’s deep PostgreSQL expertise meant they could move from prototype to production rapidly without rebuilding operational knowledge from scratch. Second, running vector search inside Aurora PostgreSQL avoided operating a separate vector store. Embeddings ran on the same managed platform, and relational filters like firm_id could be applied in the same query as similarity search.

Solution overview

CORTO’s production architecture is a multi-tenant system purpose-built for scale, performance, and cost efficiency, organized into three functional layers: an Integration Pillar for document ingestion, a Data Pillar for storage and retrieval, and an AI Layer for embedding and language model processing. The following diagram illustrates how CORTO ingests legal documents from clients, converts them into vector embeddings, stores them in Aurora PostgreSQL with pgvector, and serves them through the AI API.

CORTO architecture showing documents flowing from client storage through Amazon Textract and Amazon S3 to Amazon ECS embedding, then to Aurora PostgreSQL pgvector and Amazon DynamoDB, served through the AI API

Figure 1: CORTO’s multi-tenant architecture across the Integration, Data, and AI layers

Integration Pillar: This layer connects to external cloud storage providers where CORTO’s clients load their legal documents. CORTO uses Amazon Textract to extract documents, handling everything from native PDFs to scanned legacy files, staging the extracted content in Amazon Simple Storage Service (Amazon S3) as the central document repository. CORTO implements priority-based ingestion (detailed in the Document Processing Pipeline section) to balance real-time and batch processing. The system ingests important documents, such as newly uploaded files and active matter content, in near real-time, and processes non-critical documents in batch through Amazon Simple Queue Service (Amazon SQS) queues.

Data Pillar: CORTO stores the 384-dimension vectors in a dedicated Aurora PostgreSQL cluster with pgvector for fast semantic search, and stores document metadata and text chunks in Amazon DynamoDB for efficient ingestion and retrieval. This separation keeps Aurora PostgreSQL optimized purely for vector operations, while DynamoDB handles high-throughput retrieval of the actual document content that surfaces in search results. A separate Aurora PostgreSQL cluster serves as the AI memory layer, persisting conversational context and session state to support coherent, multi-turn legal research interactions.

AI Layer: From S3, CORTO passes documents to an Amazon Elastic Container Service (Amazon ECS)-based processing pipeline that performs chunking and generates vector embeddings using a self-hosted Nomic embedding model. At query time, the system’s AI API, also hosted on Amazon ECS, orchestrates retrieval across the Data Pillar stores to deliver contextually aware, matter-ready responses to external clients.

Today, the platform manages 7.6 billion vectors across 2.5 billion documents in a 46 TB Aurora PostgreSQL cluster deployed for Asia Pacific (APAC) customers, with two additional clusters serving Americas and EU customers.

Technical implementation journey

read more

https://aws.amazon.com/blogs/database/cortos-billion-scale-legal-semantic-search-with-aurora-postgresql-pgvector/