Skip to main content
Use the Google BigQuery connector to index from a BigQuery table without writing an indexing script. In this quickstart, you import a sample product dataset into BigQuery, create a source for the BigQuery table, use an Algolia destination, and create an on-demand synchronization task.

Before you begin

Make sure you have:
  • An Algolia account. Create one for free if you don’t already have one.
  • A Google Cloud account and project. Select or create the project where you want to store the sample BigQuery table.
  • The BigQuery API enabled for your Google Cloud project. If the BigQuery API isn’t enabled, enable it from the BigQuery API page.
  • Permission to create and load BigQuery datasets and tables, create a Google service account and key, and grant IAM roles. If your organization restricts service account keys or IAM changes, ask your Google Cloud administrator to complete those steps.

Set up the Google BigQuery connector

Create a source, destination, transformation, and synchronization task for the sample BigQuery table. The source identifies the BigQuery table to read. The destination identifies the Algolia index. The transformation enriches the records. The task determines when the connector runs.
1

Select your project in Cloud Hub

Open Cloud Hub and select the Google Cloud project where you want to create the BigQuery dataset. Make a note of the project’s ID. You use this value when configuring the connector source.Select the project itself, not an App Hub app or an app-enabled folder. You don’t need to configure an App Hub app for this quickstart.
2

Set the quickstart variables

In the Google Cloud console’s top toolbar, select the Activate Cloud Shell (>_) icon.Set the variables:
Cloud Shell
Paste these commands exactly as shown. Cloud Shell sets GOOGLE_CLOUD_PROJECT to the project you selected in Cloud Hub. Change LOCATION to use another BigQuery location.
3

Create the BigQuery dataset

Create a dataset for the sample table:
Cloud Shell
4

Download the sample data

Download the newline-delimited JSON sample data:
Cloud Shell
5

Load the sample data into BigQuery

The --replace option overwrites any existing table named apparel in the selected dataset. Change TABLE_ID if you need to preserve an existing table.
Cloud Shell
For more information, see Loading JSON data from a local file.
6

Verify the BigQuery import

Count the imported rows and unique object IDs:
Cloud Shell
Confirm that records and unique_object_ids have the same value.
7

Create the connector service account

Create a dedicated service account for the Algolia connector:
Cloud Shell
8

Grant the BigQuery permissions

Grant the service account permission to run BigQuery jobs in the project:
Cloud Shell
Grant the service account read access to the quickstart dataset:
Cloud Shell
9

Create and download the service account key

Create a JSON key:
Cloud Shell
Download the key from Cloud Shell:
Cloud Shell
Your browser downloads algolia-bigquery-key.json. You upload this file when you configure the connector source.If your organization prevents service account key creation, ask your Google Cloud administrator whether they can create an approved key for this dedicated service account.
10

Choose the Google BigQuery connector

Go to the Algolia dashboard and select your Algolia application. Open the Connectors page.Find Google BigQuery, then select Connect.
11

Configure the Google service account authentication

Under Google Service Account, select Search or create an authentication, then Create a new Google Service Account authentication.Upload algolia-bigquery-key.json as the Service Account File.In Name, enter BigQuery quickstart service account, then select Create authentication.
12

Configure the BigQuery source

Under Select your BigQuery table, enter or select the following BigQuery details:Leave the custom SQL statement empty. Without a custom SQL statement, the connector reads all rows and columns from the selected table.In Connector name, enter Quickstart products BigQuery source, then select Create source.
13

Delete the service account file

After you have created the source, delete the key file from Cloud Shell:
Cloud Shell
Delete the downloaded copy from your computer after uploading it to Algolia. Deleting these files doesn’t revoke the key used by the connector.
14

Transform the records

This transformation adds a price_range attribute to each record. After the connector indexes your records, you can display price_range or configure it as a facet.Select Transform using the code editor and replace the placeholder Transformation code with this function:
JavaScript
Select Save.
15

Choose the destination index

Under Configure your destination, select Create a new destination.Under Search, enter quickstart-products as the index name.
If you enter the name of an existing index, the connector overwrites the records and settings in that index.
16

Create the destination

Under Index credentials, select Create one for me.To use an existing API key, choose one with the addObject, deleteIndex, and editSettings ACLs.In Name, enter BigQuery quickstart products destination, then select Create destination.
17

Create and run an on-demand synchronization task

Under Configure your task, select On demand.Select Full reindexing.Select Create task, then Run.Wait for the task to finish.
18

Verify the indexed records

Open the quickstart-products index in the Algolia dashboard.The index contains the imported product records, with attributes such as title, description, product_type, price, price_range, and showcase_image.
You can use this index as the data source for Build your first search experience.Before you build the UI, configure product_type as an attribute for faceting in the quickstart-products index.

Index your own BigQuery data

Authenticate the connector with a dedicated Google service account. Don’t reuse a service account that can update or delete your production BigQuery data.

Authentication

Grant the service account these roles: If your organization uses a custom IAM role instead, include these permissions:
BigQuery permissions

Cloud Storage data

If the connector service account reads the table’s Cloud Storage objects directly, grant it the Storage Object Viewer role (roles/storage.objectViewer) on each source bucket. If your organization uses a custom IAM role instead, include these permissions:
Cloud Storage permissions

JSON key

Create a Google service account JSON key and upload the key file when you configure the BigQuery source.
A service account JSON key is a long-lived credential. Store it securely, don’t add it to source control, and delete local copies after uploading it to Algolia.

Customize the data you index with SQL

By default, the connector imports all rows and columns from the selected table. In the BigQuery source’s Custom SQL statement field, enter a GoogleSQL statement to filter rows, combine columns, or calculate attributes. Use %s as the placeholder for the selected table. For example:
SQL
The query result must include the column selected as the source’s unique identifier. Its value must be present, unique, and stable for every returned row. An existing objectID column is suitable. If your table uses a composite key, return its components as a single column. For example:
SQL
You can instead assign objectID in an Algolia transformation if the BigQuery source provides a stable unique identifier.

Transformations

Use transformations to add computed attributes or change values before the connector indexes your records. To use a transformed attribute for search, faceting, or ranking, update the relevant index settings, such as searchableAttributes, attributesForFaceting, or customRanking.
Test transformations with repeated task runs. Transformations that read from and write to the same attribute, or extract a value and then delete the source attribute, can produce different results when the task runs again.

Synchronization schedule

After you create a task, you can edit it in the Algolia dashboard to choose when the connector runs:
  • On demand. Run the connector manually.
  • Scheduled. Select a predefined schedule or enter a custom cron expression.

Indexing strategy

You can choose how the connector updates your index. For information about full reindexing, full record updates, and partial record updates, see Data synchronization strategies.
To stay within your BigQuery quota, don’t schedule a Google BigQuery connector task to run more than once per day.

Limitations

This connector is subject to the following limitations:

See also

Last modified on August 27, 2026