Keyword search finds rows that contain a word. Semantic search finds rows that mean the same thing, even when the words differ: "late parcel" matches "my order took two weeks". In November Google added three pieces to BigQuery that make this practical from SQL: a rerank option for AI.SEARCH and the new AI.RANK function (both generally available on 17 November), and AI indexes (preview, 19 November), which build and maintain the embeddings for you.
1. AI.SEARCH: find rows by meaning
AI.SEARCH needs a table that already has embeddings, either through an AI index or through an automatically generated embedding column. This example from Google's documentation creates a product table whose embedding column fills itself whenever rows are inserted:
CREATE TABLE mydataset.products (
name STRING,
description STRING,
description_embedding STRUCT<result ARRAY<FLOAT64>, status STRING>
GENERATED ALWAYS AS (AI.EMBED(
description,
connection_id => 'us.example_connection',
endpoint => 'text-embedding-005'
))
STORED OPTIONS( asynchronous = TRUE )
);
INSERT INTO mydataset.products (name, description) VALUES
("Lounger chair", "A comfortable chair for relaxing in."),
("Super slingers", "An exciting board game for the family."),
("Encyclopedia set", "A collection of informational books.");
SELECT base.name, base.description, distance
FROM AI.SEARCH(TABLE mydataset.products, 'description', "A really fun toy");The board game comes first, although the word "toy" appears nowhere. Each result has a base struct with the table's columns and a distance: lower means closer.
AI.SEARCH arguments worth knowing
- Base table or query
TABLE mydataset.products, or a query to pre-filter it. Only SELECT, FROM and WHERE are allowed in that query.- mode
'VECTOR','HYBRID'(vector plus keyword) or'AUTO', the default.- top_k
- How many rows to return. The default is 10.
- distance_type
'EUCLIDEAN'(default),'COSINE'or'DOT_PRODUCT'.- rerank
TRUEadds arerank_scorefrom 0 to 1 and reorders the candidates.
2. AI.RANK: sort any rows by relevance
AI.RANK does not need embeddings at all. You give it rows, a text column and a question, and it returns each row with a rank (1 is best) and a score between 0 and 1. It runs on a public dataset, so you can try it now:
SELECT rank, score, title
FROM AI.RANK(
TABLE `bigquery-public-data.bbc_news.fulltext`,
'title',
'downward trends in the housing market',
top_n => 5
);Ranking costs money for every row it scores, so narrow the rows first. Here only business stories are ranked, on the full article text:
SELECT rank, score, title
FROM AI.RANK(
(
SELECT title, body
FROM `bigquery-public-data.bbc_news.fulltext`
WHERE category = 'business'
),
'body',
'executives who resigned after an accounting scandal',
top_n => 3
);AI.SEARCH
Retrieve- Fast over large tables, using embeddings and indexes
- Returns the closest candidates by distance
- Distance is not a relevance score you can explain to users
Use it to go from millions of rows to tens.
AI.RANK
Rerank- A clear 0 to 1 relevance score per row
- Works on any rows, no embeddings needed
- Billed per row ranked, so keep the input small
Use it to go from tens of rows to the right five.
You can also do both in one call: AI.SEARCH(..., top_k => 5, rerank => TRUE) retrieves candidates (by default five times top_k) and reranks them. Reranking needs the Discovery Engine API enabled and the discoveryengine.rankingConfigs.rank permission, which the Discovery Engine Viewer role includes.
3. AI indexes: no embedding pipeline at all (preview)
An AI index is BigQuery's managed shortcut: you name the text columns, and BigQuery creates and maintains the embeddings in the background.
CREATE AI INDEX products_ai_index
ON mydataset.products(name, description);
-- or let BigQuery pick up to 50 text columns
CREATE AI INDEX products_ai_index
ON mydataset.products(AUTO COLUMNS);Indexing runs in the background. Check INFORMATION_SCHEMA.AI_INDEXES for the state, the coverage percentage and the number of rows not yet indexed, because AI.SEARCH only searches rows that have been processed. When a table has an AI index, you do not need to name the column to search.
Preview limits to know
- One index per table
- Up to 50 top-level, non-repeated STRING columns. To change the columns, drop and recreate the index.
- Standard tables only
- Not views, external or BigLake tables, Iceberg tables or snapshots.
- Row limits at creation
- 1 million rows on on-demand pricing, or 100 million with a BACKGROUND reservation.
- AUTO COLUMNS
- Picks columns once, at creation; it may include IDs or URLs, so a named list is usually better.
- Not for exact matches
- IDs, codes and numbers belong in WHERE clauses, not in the search phrase.
What it costs
- Search (vector and hybrid) uses normal BigQuery compute.
- Embeddings for indexed rows and for search phrases follow the price of the embedding model used.
- AI index: creating and dropping is free; background indexing is billed like DML, or uses slots if you assign a BACKGROUND reservation; index storage is billed as storage.
- Reranking (AI.RANK or
rerank => TRUE) is billed through the ranking API for every row ranked.
When to use it
- 1
Support and feedback
Find all tickets or reviews about the same problem, whatever words customers used.
- 2
Product catalogues
Let analysts search descriptions in plain language to build segments.
- 3
Before an LLM call
Retrieve the five most relevant documents, then pass only those to an AI function.
- 4
Deduplication
Find near-duplicate records that exact matching misses.
Check your understanding
1/3What does AI.RANK return for each row?
It sorts rows by how well a text column answers your query.
2/3Why filter rows before calling AI.RANK?
Retrieve or filter first, then rank a small set.
3/3What is the status of AI indexes in BigQuery?
AI.RANK and the rerank option became generally available on 17 November.
You got 0 out of 3.
More: embeddings and vector search for analysts, the BigQuery November update and the SQL cheat sheet.
Sources: BigQuery release notes (16 to 19 November 2026), Google Cloud documentation for AI.SEARCH and AI.RANK (examples quoted from it), and a detailed walkthrough of CREATE AI INDEX by TechInnovateIT. Preview features can change before general availability.
