This page describes how to purge all of the data in a structured or unstructured data store.
You purge the data in a data store if you want to completely delete the contents of the data store before re-importing fresh data. Purging a data store deletes only the data in the data store, leaving your app, schema, and configurations intact.
For how to delete a data store, see Delete a datastore .
Purge data
To purge data from a data store, do the following:
Console
To use the Google Cloud console to purge the data from a branch of a structured or unstructured, follow these steps:
-
In the Google Cloud console, go to the Agentspacepage.
-
In the navigation menu, click Data Stores.
-
In the Namecolumn, click the data store that you want to purge.
-
In the Documentstab, click Purge data.
-
Read the warning in the Confirm purge datadialog. If you want to continue, enter the name of your data store, and then click Confirm. Purging data is a long-running operation. For more information, see Monitor long-running operations .
-
Click the Activitytab to monitor the progress of the purge operation.
REST
To use the command line to purge the data from a branch of a structured or unstructured data store, follow these steps:
-
Find your data store ID. If you already have your data store ID, skip to the next step.
-
In the Google Cloud console, go to the Agentspacepage and in the navigation menu, click Data Stores.
-
Click the name of your data store.
-
On the Datapage for your data store, get the data store ID.
-
-
Call the
documents.purge
method.curl -X POST \ -H "Authorization: Bearer $( gcloud auth print-access-token ) " \ -H "Content-Type: application/json" \ "https://discoveryengine.googleapis.com/v1/projects/ PROJECT_ID /locations/global/collections/default_collection/dataStores/ DATA_STORE_ID /branches/0/documents:purge" \ -d '{ "filter": "*", "force": FORCE }'
Replace the following:
-
PROJECT_ID
: Google Cloud project -
DATA_STORE_ID
: the ID of the data store. -
FORCE
: a boolean value that specifies whether to delete data from the branch of the data store.- If
true
, deletes all data from the branch - If
false
, deletes no data and returns a list of documents in the branch. - If
force
is omitted, the default isfalse
.
- If
-
-
Optional: Make note of the
name
value returned by thedocuments.purge
method and follow the instructions in Get details about a long-running operation to see when the purge operation is complete.
C#
Before trying this sample, follow the C# setup instructions in the Agentspace quickstart using client libraries . For more information, see the Agentspace C# API reference documentation .
To authenticate to Agentspace, set up Application Default Credentials. For more information, see Set up authentication for a local development environment .
Go
Before trying this sample, follow the Go setup instructions in the Agentspace quickstart using client libraries . For more information, see the Agentspace Go API reference documentation .
To authenticate to Agentspace, set up Application Default Credentials. For more information, see Set up authentication for a local development environment .
Java
Before trying this sample, follow the Java setup instructions in the Agentspace quickstart using client libraries . For more information, see the Agentspace Java API reference documentation .
To authenticate to Agentspace, set up Application Default Credentials. For more information, see Set up authentication for a local development environment .
Node.js
Before trying this sample, follow the Node.js setup instructions in the Agentspace quickstart using client libraries . For more information, see the Agentspace Node.js API reference documentation .
To authenticate to Agentspace, set up Application Default Credentials. For more information, see Set up authentication for a local development environment .
Python
Before trying this sample, follow the Python setup instructions in the Agentspace quickstart using client libraries . For more information, see the Agentspace Python API reference documentation .
To authenticate to Agentspace, set up Application Default Credentials. For more information, see Set up authentication for a local development environment .
Ruby
Before trying this sample, follow the Ruby setup instructions in the Agentspace quickstart using client libraries . For more information, see the Agentspace Ruby API reference documentation .
To authenticate to Agentspace, set up Application Default Credentials. For more information, see Set up authentication for a local development environment .