Skip to main content
Compatibility: Only available on Node.js.
Oracle AI Database supports AI workloads where you query data by meaning (semantics), not just keywords. It combines semantic search over unstructured content with relational filtering over business data in a single system, so you can build retrieval workflows (like RAG) without introducing a separate vector database and fragmenting data across multiple platforms. This guide demonstrates how to use OracleVS (the LangChain vector store integration for Oracle AI Vector Search) to:
  • Ingest documents and embeddings into Oracle
  • Run similarity search
  • Create HNSW and IVF indexes
  • Apply metadata filters for advanced retrieval
  • Enable hybrid search (keyword + semantic) in Oracle AI Database 26ai
  • Run full-text search using Oracle Text

Overview

Integration details

Setup

Install Oracle client bindings and the LangChain Oracle helpers:
Set connection credentials for the Oracle user that will own the vector table:

Create a vector store

The example below assumes that you already created a table with vector and metadata columns and generated embeddings using OracleEmbeddings.
If your application already manages an Oracle Database connection pool, pass the pool directly to OracleVS. The store acquires and releases connections as needed.

Filter search results

You can pass rich metadata filters as the third argument to similaritySearch, similaritySearchWithScore, or similaritySearchVectorWithScore. Filters operate on the JSON metadata column that Oracle VS maintains for each document. Supported comparison operators include $eq (default), $ne, $lt, $lte, $gt, $gte, $in, $nin, $between, and $exists. Combine clauses with $and and $or to build more expressive predicates.
Nested logical clauses are also supported. For example:

Accelerate search with vector indexes

Oracle Database can speed up similarity queries by creating vector indexes on the embedding column. The @oracle/langchain-oracledb helpers expose a createIndex utility that provisions either HNSW (default) or IVF indexes.

HNSW index (default)

Use HNSW when you want a graph-based index that balances recall and latency. Omit idxType to use the default configuration or override parameters such as neighbors, efConstruction, and accuracy.

IVF index

Switch to IVF by passing idxType: "IVF" along with the number of neighbor partitions to create. IVF partitions vectors into clusters and is useful when you want coarse quantization with predictable memory usage.
Run createIndex once after loading data (or after initialize) and reuse the index for subsequent searches. To rebuild or swap strategies, drop the existing index through standard SQL (DROP INDEX ...) and rerun createIndex with new parameters.

Next steps