Stay organized with collections
Save and categorize content based on your preferences.
To ingest data from Bigtable, use the following steps to create
a data store and ingest data using the API.
Set up Bigtable access
To give Agentspace access to Bigtable data that's
in a different project, follow these steps:
Replace the following PROJECT_NUMBER variable with your
Agentspace project number, then copy the contents of this
code block. This is your Agentspace service account
identifier:
DATA_STORE_ID: the ID of the data store. The ID can
contain only lowercase letters, digits, underscores, and hyphens.
BIGTABLE_PROJECT_ID: the ID of your
Bigtable project.
INSTANCE_ID: the ID of your Bigtable
instance.
TABLE_ID: the ID of your Bigtable
table.
KEY_FIELD_NAME: optional but recommended. The field name to
use for the row key value after ingesting to Agentspace.
KEY: required. A string value for the column family key.
ENCODING: optional. The encoding mode of the values when the
type is not STRING.This can be overridden for a specific column by
listing that column in columns and specifying an encoding for it.
COLUMN_TYPE: optional. The type of values in this column
family.
QUALIFIER: required. Qualifier of the column.
FIELD_NAME: optional but recommended. The field name to use
for this column after ingesting to Agentspace.
COLUMN_ENCODING: optional. The encoding mode of the values
for a specific column when the type is not STRING.
RECONCILIATION_MODE: optional. Values are FULL and
INCREMENTAL. Default is INCREMENTAL. Specifying INCREMENTAL
causes an incremental refresh of data from Bigtable to
your data store. This does an upsert operation, which adds new
documents and replaces existing documents with updated documents with
the same ID. Specifying FULL causes a full rebase of the documents in
your data store. In other words, new and updated documents are added to
your data store, and documents that are not in Bigtable
are removed from your data store. The FULL mode is helpful if you
want to automatically delete documents that you no longer need.
AUTO_GENERATE_IDS: optional. Specifies whether to
automatically generate document IDs. If set to true, document IDs
are generated based on a hash of the payload. Note that generated
document IDs might not remain consistent over multiple imports. If
you auto-generate IDs over multiple imports, Google highly
recommends setting reconciliationMode to FULL to maintain
consistent document IDs.
Specify autoGenerateIds only when bigquerySource.dataSchema is
set to custom. Otherwise an INVALID_ARGUMENT error is
returned. If you don't specify autoGenerateIds or set it to
false, you must specify idField. Otherwise the documents fail to
import.
ID_FIELD: optional. Specifies which fields are the
document IDs.
Next steps
To attach your data store to an app, create an app and select your data store
following the steps in
Create a search app.
To preview how your search results appear after your app and data store are
set up, see
Preview search results.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-03 UTC."],[],[],null,["# Import from Bigtable\n\n| **Note:** Importing data from Bigtable is in Public preview.\n\nTo ingest data from Bigtable, use the following steps to create\na data store and ingest data using the API.\n\nSet up Bigtable access\n----------------------\n\nTo give Agentspace access to Bigtable data that's\nin a different project, follow these steps:\n\n1. Replace the following \u003cvar translate=\"no\"\u003ePROJECT_NUMBER\u003c/var\u003e variable with your\n Agentspace project number, then copy the contents of this\n code block. This is your Agentspace service account\n identifier:\n\n service-\u003cvar translate=\"no\"\u003ePROJECT_NUMBER\u003c/var\u003e@gcp-sa-discoveryengine.iam.gserviceaccount.com`\n\n2. Go to the **IAM \\& Admin** page.\n\n [IAM \\& Admin](https://console.cloud.google.com/iam-admin/iam)\n3. Switch to your Bigtable project on the **IAM \\& Admin** page\n and click **Grant Access**.\n\n4. For **New principals** , enter the instance's service account identifier and\n select the **Bigtable \\\u003e Bigtable Reader** role.\n\n5. Click **Save**.\n\n6. Switch back to your Agentspace project.\n\nNext, go to [Import data from Bigtable](#bigtable-procedure).\n\nImport data from Bigtable\n-------------------------\n\n### REST\n\nTo use the command line to create a data store and ingest data from\nBigtable, follow these steps:\n\n1. Create a data store.\n\n curl -X POST \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"Content-Type: application/json\" \\\n -H \"X-Goog-User-Project: \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\" \\\n \"https://discoveryengine.googleapis.com/v1alpha/projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/global/collections/default_collection/dataStores?dataStoreId=\u003cvar translate=\"no\"\u003eDATA_STORE_ID\u003c/var\u003e\" \\\n -d '{\n \"displayName\": \"\u003cvar translate=\"no\"\u003eDISPLAY_NAME\u003c/var\u003e\",\n \"industryVertical\": \"GENERIC\",\n \"solutionTypes\": [\"SOLUTION_TYPE_SEARCH\"],\n }'\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of your project.\n - \u003cvar translate=\"no\"\u003eDATA_STORE_ID\u003c/var\u003e: the ID of the data store. The ID can contain only lowercase letters, digits, underscores, and hyphens.\n - \u003cvar translate=\"no\"\u003eDISPLAY_NAME\u003c/var\u003e: the display name of the data store. This might be displayed in the Google Cloud console.\n2. Import data from Bigtable.\n\n curl -X POST \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"Content-Type: application/json\" \\\n \"https://discoveryengine.googleapis.com/v1/projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/global/collections/default_collection/dataStores/\u003cvar translate=\"no\"\u003eDATA_STORE_ID\u003c/var\u003e/branches/0/documents:import\" \\\n -d '{\n \"bigtableSource \": {\n \"projectId\": \"\u003cvar translate=\"no\"\u003eBIGTABLE_PROJECT_ID\u003c/var\u003e\",\n \"instanceId\": \"\u003cvar translate=\"no\"\u003eINSTANCE_ID\u003c/var\u003e\",\n \"tableId\": \"\u003cvar translate=\"no\"\u003eTABLE_ID\u003c/var\u003e\",\n \"bigtableOptions\": {\n \"keyFieldName\": \"\u003cvar translate=\"no\"\u003eKEY_FIELD_NAME\u003c/var\u003e\",\n \"families\": {\n \"key\": \"\u003cvar translate=\"no\"\u003eKEY\u003c/var\u003e\",\n \"value\": {\n \"fieldName\": \"\u003cvar translate=\"no\"\u003eFIELD_NAME\u003c/var\u003e\",\n \"encoding\": \"\u003cvar translate=\"no\"\u003eENCODING\u003c/var\u003e\",\n \"type\": \"\u003cvar translate=\"no\"\u003eTYPE\u003c/var\u003e\",\n \"columns\": [\n {\n \"qualifier\": \"\u003cvar translate=\"no\"\u003eQUALIFIER\u003c/var\u003e\",\n \"fieldName\": \"\u003cvar translate=\"no\"\u003eFIELD_NAME\u003c/var\u003e\",\n \"encoding\": \"\u003cvar translate=\"no\"\u003eCOLUMN_ENCODING\u003c/var\u003e\",\n \"type\": \"\u003cvar translate=\"no\"\u003eCOLUMN_VALUES_TYPE\u003c/var\u003e\"\n }\n ]\n }\n }\n ...\n }\n },\n \"reconciliationMode\": \"\u003cvar translate=\"no\"\u003eRECONCILIATION_MODE\u003c/var\u003e\",\n \"autoGenerateIds\": \"\u003cvar translate=\"no\"\u003eAUTO_GENERATE_IDS\u003c/var\u003e\",\n \"idField\": \"\u003cvar translate=\"no\"\u003eID_FIELD\u003c/var\u003e\",\n }'\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of your Agentspace project.\n - \u003cvar translate=\"no\"\u003eDATA_STORE_ID\u003c/var\u003e: the ID of the data store. The ID can contain only lowercase letters, digits, underscores, and hyphens.\n - \u003cvar translate=\"no\"\u003eBIGTABLE_PROJECT_ID\u003c/var\u003e: the ID of your Bigtable project.\n - \u003cvar translate=\"no\"\u003eINSTANCE_ID\u003c/var\u003e: the ID of your Bigtable instance.\n - \u003cvar translate=\"no\"\u003eTABLE_ID\u003c/var\u003e: the ID of your Bigtable table.\n - \u003cvar translate=\"no\"\u003eKEY_FIELD_NAME\u003c/var\u003e: optional but recommended. The field name to use for the row key value after ingesting to Agentspace.\n - \u003cvar translate=\"no\"\u003eKEY\u003c/var\u003e: required. A string value for the column family key.\n - \u003cvar translate=\"no\"\u003eENCODING\u003c/var\u003e: optional. The encoding mode of the values when the type is not STRING.This can be overridden for a specific column by listing that column in `columns` and specifying an encoding for it.\n - \u003cvar translate=\"no\"\u003eCOLUMN_TYPE\u003c/var\u003e: optional. The type of values in this column family.\n - \u003cvar translate=\"no\"\u003eQUALIFIER\u003c/var\u003e: required. Qualifier of the column.\n - \u003cvar translate=\"no\"\u003eFIELD_NAME\u003c/var\u003e: optional but recommended. The field name to use for this column after ingesting to Agentspace.\n - \u003cvar translate=\"no\"\u003eCOLUMN_ENCODING\u003c/var\u003e: optional. The encoding mode of the values for a specific column when the type is not STRING.\n - \u003cvar translate=\"no\"\u003eRECONCILIATION_MODE\u003c/var\u003e: optional. Values are `FULL` and `INCREMENTAL`. Default is `INCREMENTAL`. Specifying `INCREMENTAL` causes an incremental refresh of data from Bigtable to your data store. This does an upsert operation, which adds new documents and replaces existing documents with updated documents with the same ID. Specifying `FULL` causes a full rebase of the documents in your data store. In other words, new and updated documents are added to your data store, and documents that are not in Bigtable are removed from your data store. The `FULL` mode is helpful if you want to automatically delete documents that you no longer need.\n - \u003cvar translate=\"no\"\u003eAUTO_GENERATE_IDS\u003c/var\u003e: optional. Specifies whether to\n automatically generate document IDs. If set to `true`, document IDs\n are generated based on a hash of the payload. Note that generated\n document IDs might not remain consistent over multiple imports. If\n you auto-generate IDs over multiple imports, Google highly\n recommends setting `reconciliationMode` to `FULL` to maintain\n consistent document IDs.\n\n Specify `autoGenerateIds` only when `bigquerySource.dataSchema` is\n set to `custom`. Otherwise an `INVALID_ARGUMENT` error is\n returned. If you don't specify `autoGenerateIds` or set it to\n `false`, you must specify `idField`. Otherwise the documents fail to\n import.\n - \u003cvar translate=\"no\"\u003eID_FIELD\u003c/var\u003e: optional. Specifies which fields are the\n document IDs.\n\n\n\u003cbr /\u003e\n\nNext steps\n----------\n\n- To attach your data store to an app, create an app and select your data store\n following the steps in\n [Create a search app](/agentspace/docs/create-app).\n\n- To preview how your search results appear after your app and data store are\n set up, see\n [Preview search results](/agentspace/docs/preview-search-results)."]]