Semantic search

Search your Postgres tables by meaning.

Rivestack semantic search ranks the rows of your own Postgres table by meaning: you type a question in plain language in the dashboard and get the closest rows back with a similarity score. Rivestack embeds the question with OpenAI text-embedding-3-small and runs the pgvector query in your database, so there is no separate vector service and no query embedding code to write.

Solo trial: 7 days free for new customers, then $29/month. Card required. Cancel anytime.

The query Rivestack runs
-- $1 is your question, embedded
-- with text-embedding-3-small
SELECT content,
  round((1 - (embedding <=> $1))::numeric, 4)
    AS similarity
FROM docs
ORDER BY embedding <=> $1
LIMIT 10;

You pick the table and columns. The query runs on your database, against the rows as they are right now.

How it works

Three steps from a table to search by meaning

01

Put vectors next to your rows

Add a vector(1536) column to a table in the public schema. In the Table editor, type plain text into the vector field and Rivestack fills in the embedding when you insert the row. Your own code can fill the column too.

02

Pick the table

Open Semantic search in the dashboard. Choose the database, the table, the vector column, and a text column to show next to each result. No data yet? Generate the sample table and try it there first.

03

Ask in plain language

Type a question. Rivestack embeds it once, runs a cosine search with pgvector, and returns the closest rows with a similarity score, the query time measured by Postgres, and whether an index was used.

The sample table holds short sentences in eight topics, with real embeddings and an HNSW index. Generating it uses one embedding request and replaces the sample table if it already exists. Already a customer? Open Semantic search in the dashboard.

Embedding models

One model for typed questions: text-embedding-3-small

Rivestack embeds typed questions with OpenAI text-embedding-3-small. Embeddings Rivestack makes for your rows, from the Table editor, the embed endpoint, or embed('...') in the SQL editor, come from the same model at 1536 dimensions.

Your column can be smaller than 1536. Rivestack embeds the question at the column's size, which works because text-embedding-3-small can return shorter vectors. The rows must come from text-embedding-3-small at that same size.

Vectors from another model are not comparable with the question. When the sizes differ, the search returns an error that says so. When the sizes match, the search still runs, but the ranking means nothing. You can still store and query those vectors with plain SQL and pgvector, or pass your own query vector to the MCP similarity_search tool.

When rows change

How sync works when rows change

There is nothing to sync. Search runs on your table, not on a copy, so every search sees the rows as they are when it runs. What Rivestack does not do is re-embed rows for you. A vector changes only when something writes a new one.

New rows

Insert in the Table editor with text in the vector field, and Rivestack embeds it before the insert. Rows your app writes need a vector from your code: call the embed endpoint or your own pipeline in the same code path. The row is searchable once the write commits.

Edited rows

If the text changes, the old vector stays until you write a new one. In the Table editor, switch the vector field to text and generate it again. From code, embed the new text and update the column.

Deleted rows

A deleted row stops showing up as soon as the delete commits. There is no second store holding an old copy.

Cost

Included in the plan price

Semantic search and the embeddings Rivestack makes are part of your plan. There is no charge per search or per embedding, and you do not bring an OpenAI key. Instead, usage has daily limits, listed below. Solo is $29/month after the 7-day trial, card required. See pricing for every plan and region.

Limits

Limits on dedicated plans, Solo and up

LimitValue
Searches500 per account per day. Resets at midnight UTC. Running the latency probe counts as one search.
AI requests500 per account per day, shared by embedding requests (Table editor, embed endpoint, embed() in the SQL editor, the sample table) and text-to-SQL. Resets at midnight UTC. Each request counts once, however many texts it carries.
Results per search1 to 50 through the API. Default 10. The dashboard shows 10.
Texts per embed request20
embed() calls per statement in the SQL editor10
Vector size for typed questionsUp to 1536 dimensions, from text-embedding-3-small
Tables you can searchOrdinary tables in the public schema with at least one vector column
Query timeout30 seconds

Hobby databases have lower daily limits: 50 searches and 50 AI requests. Past a limit, the request returns an error until midnight UTC.

Versus doing it yourself

Versus building it yourself with pgvector

Underneath, this is the pgvector query you would write yourself. What changes is who does the steps around it.

StepBuilding it yourselfWith Rivestack
Embed the questionCall an embedding API from your app before every search, with your own key.Rivestack embeds the typed question with its own OpenAI access.
Write the search queryWrite the ORDER BY embedding <=> query LIMIT n statement and quote the identifiers.The dashboard builds it from the table and columns you pick.
Fill vectors for rowsRun your own embedding pipeline.Type text in the Table editor, or call the embed endpoint with up to 20 texts. Your own pipeline still works.
Check the index is usedRun EXPLAIN ANALYZE by hand.Each result says whether an index was used and how long Postgres took.

Build it yourself when you need another embedding model, filters in a WHERE clause, keyword and vector ranking combined, or more than 50 results. It is standard pgvector on standard Postgres, so you can do all of that with SQL on the same database, next to the dashboard search.

API and MCP

The same search from code or an agent

The dashboard calls the public API, so your code can too. Create an API key in Settings and send it as a Bearer token.

search.sh
curl https://api.rivestack.io/api/ha/$DATABASE_ID/semantic/search \
  -H "Authorization: Bearer $RIVESTACK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": "how do I rotate a password",
       "table": "docs",
       "vector_column": "embedding",
       "text_column": "content",
       "limit": 5}'

Endpoints

  • GET /api/ha/{id}/semantic/tables lists the tables you can search.
  • POST /api/ha/{id}/semantic/search runs a search.
  • POST /api/ha/{id}/embed embeds up to 20 texts.
  • POST /api/ha/{id}/semantic/seed creates the sample table.

MCP

The hosted MCP server has a similarity_search tool. Give it a question, a table, and the vector column, and it runs the same search as the dashboard. Give it a vector instead, and it runs the pgvector query directly. MCP works with Solo and up. Set up MCP.

FAQ

Semantic search questions

Do I need an OpenAI API key?

No. Rivestack makes the embeddings with its own OpenAI access, and the cost is part of your plan price. Typed questions and any text you embed are sent to OpenAI to make the vector. OpenAI is listed on the sub-processors page.

Does Rivestack re-embed a row when its text changes?

No. Rivestack does not watch your tables or embed rows in the background. A vector changes only when something writes a new one: the Table editor, the embed endpoint, embed() in the SQL editor, or your own code. Search always reads the table as it is, so a new vector is searchable as soon as the write commits.

Can I use a different embedding model?

Not for typed questions. They are embedded with OpenAI text-embedding-3-small, so the column must hold vectors from that model, at any size up to 1536 dimensions. Vectors from another model still work with plain SQL and pgvector, and the MCP similarity_search tool accepts a vector you made yourself.

Which tables show up?

Ordinary tables in the public schema that have at least one vector column. The text column you show next to each result can be text, varchar, char, citext, name, or uuid.

Do I need an index?

No. Without one, Postgres compares the question with every row. The search orders by cosine distance, so build the index with vector_cosine_ops, for example an HNSW index. Each result tells you whether an index was used. The sample table comes with an HNSW index.

Is this a separate vector database?

No. The search is a SQL query on your own Postgres database. Results are rows from your table, and your app can query the same table with SQL at any time.

Which plans include it?

Every plan has it. Solo and the other dedicated plans get the limits on this page, and Hobby gets lower daily limits. Solo is $29/month, and new customers get a 7-day trial on it. Card required.

Semantic search

Search your own data by meaning.

Solo is 7 days free for new customers, then $29/month. Card required.