BigQuery (bigquery)¶
The bigquery connector indexes BigQuery table rows as searchable records. Each
table also exposes schema.json; when [summary].enabled is on, that schema
produces a searchable schema_summary. Use it to search large analytical tables
— a knowledge base, an events table — by meaning.
How MFS sees it¶
bigquery://analytics/
└── events/
└── tables/
└── user_events/
├── rows.jsonl table_rows → one searchable chunk per row
└── schema.json table_schema → browsable schema; searchable with summary enabled
Rows are chunked per-row and need [[objects]].text_fields to become searchable.
Credentials¶
BigQuery uses Application Default Credentials (ADC) — there is no token in the TOML; the credentials must be visible to the server process. Three common paths:
-
Service account JSON (production): in Google Cloud Console, open IAM & Admin → Service Accounts → Create service account. Name it
mfs-bigquery-reader, grantroles/bigquery.dataVieweron the target datasets or project, then open the service account's Keys tab → Add key → Create new key → JSON. Store the downloaded JSON outside the repo and point the server at it: -
gcloud auth application-default login(dev / single-user): run it as the same OS user that startsmfs-server. It opens a browser consent flow and writes~/.config/gcloud/application_default_credentials.json. -
Workload Identity on GKE / Cloud Run — ADC is automatic.
Before any of those, open APIs & Services → Library → BigQuery API and enable
it on the project. If the connector can authenticate but cannot list a dataset,
check the dataset IAM page first; the service account needs read access to every
dataset listed in datasets.
Configuration¶
project = "analytics-prod"
datasets = ["events", "kb"]
max_read_rows = 100000
[[objects]]
match = "/kb/tables/articles"
text_fields = ["title", "body_markdown"]
locator_fields = ["article_id"]
Save the file as bigquery.toml, then probe before the first index:
mfs connector probe bigquery://analytics --config ./bigquery.toml
mfs add bigquery://analytics --config ./bigquery.toml
Sync and freshness¶
The connector uses table metadata (num_rows + modified) as the table object's
fingerprint. If that fingerprint changes, MFS re-reads and re-indexes the table's
rows.jsonl object. Deletions are caught by full_scan. It reads rows via
list_rows, so max_read_rows caps large tables.
Search and browse¶
mfs search "refund event" bigquery://analytics/events/tables/user_events/rows.jsonl
mfs search "email column" bigquery://analytics --kind schema_summary
mfs cat bigquery://analytics/events/tables/user_events/schema.json
mfs cat bigquery://analytics/kb/tables/articles/rows.jsonl --locator '{"article_id":"a-123"}'
Pitfalls¶
- ADC must be visible to the server process, not just the CLI shell.
- BigQuery has no primary key for most tables — choose stable
locator_fieldsexplicitly. - Rows need
text_fieldsto be searchable. - User ADC from
gcloudis convenient for local testing; service accounts or workload identity are easier to operate in long-running deployments. schema_summarysearch requires[summary].enabled;schema.jsonis still browsable without it.