Add filters to a Google Drive data store

This page explains how to add filters to your Google Drive data stores in Gemini Enterprise. Filters let you control which Google Drive content is available to the Assistant by restricting search to specific locations or explicitly excluding specific locations from search.

Filter types

The Google Drive data store supports the following filter types:

  • Folder filter: Limits search to a specific set of Google Drive folders. You configure this filter in one of two modes:
    • Include: Search is scoped to only the folders that you list. Content in any other folder isn't included.
    • Exclude: The folders that you list are explicitly removed from search. Content in all other folders remains available.
  • Shared drive filter: Limits search to a specific set of shared drives. You configure this filter in one of two modes:
    • Include: Search is scoped to only the shared drives that you list. Content in any other shared drive isn't included.
    • Exclude: The shared drives that you list are explicitly removed from search. Content in all other shared drives remains available.

For each filter type, you configure the Include mode or Exclude mode, not both at the same time.

To find a folder ID or shared drive ID, open the folder or shared drive in Google Drive and copy the ID from the URL. The URL follows this format: https://drive.google.com/corp/drive/folders/ID. For example, https://drive.google.com/corp/drive/folders/123456789012345678901.

Update filters in an existing data store

You can update filters in an existing data store using the Google Cloud console or API.

Console

To add or update filter configurations:
  1. In the Google Cloud console navigation menu, click Data stores.
  2. Select your Google Drive data store.
  3. Click View/edit parameters.
  4. In the View/edit parameters panel, add or update the folder filter and shared drive filter. For each filter, choose Include or Exclude mode and provide the folder IDs or shared drive IDs.
  5. Click Save.

REST

To add or update filters in an existing Google Drive data store, call the updateDataConnector method.

Inclusion lists are set under admin_filter and exclusion lists are set under admin_exclusion_filter. For each filter type, populate the list under admin_filter or under admin_exclusion_filter, but not both.

In the request body, you must include all filter lists that you want to keep in the data store, including filter lists that you aren't updating.


    curl -X PATCH \
        -H "Authorization: Bearer $(gcloud auth print-access-token)" \
        -H "Content-Type: application/json" \
        -H "X-Goog-User-Project: PROJECT_ID" \
        "https://ENDPOINT_LOCATION-discoveryengine.googleapis.com/v1alpha/projects/PROJECT_ID/locations/LOCATION/collections/COLLECTION_ID/dataConnector?updateMask=params" \
        -d '{
          "params": {
            "admin_filter": {
              "SharedDriveIds": INCLUDED_SHARED_DRIVE_IDS,
              "FolderIds": INCLUDED_FOLDER_IDS
            },
            "admin_exclusion_filter": {
              "SharedDriveIds": EXCLUDED_SHARED_DRIVE_IDS,
              "FolderIds": EXCLUDED_FOLDER_IDS
            }
          }
        }'
    

Replace the following:

  • PROJECT_ID: Your project ID.
  • ENDPOINT_LOCATION: The region of your application. For example, us or eu.
  • LOCATION: The location of your data connector. It must be global or us.
  • COLLECTION_ID: The ID of the collection that contains your data connector. The collection ID is provided when you create a data store. The collection ID isn't the same as the data store ID.
  • INCLUDED_SHARED_DRIVE_IDS: A list of shared drive IDs to include in search, for example ["0ABCdEfGhIjKlMnOpQ"]. Use an empty list [] if you aren't setting an inclusion list for shared drives.
  • INCLUDED_FOLDER_IDS: A list of folder IDs to include in search, for example ["1AbCdEfGhIjKlMnOpQrStUvWxYz"]. Use an empty list [] if you aren't setting an inclusion list for folders.
  • EXCLUDED_SHARED_DRIVE_IDS: A list of shared drive IDs to exclude from search. Use an empty list [] if you aren't setting an exclusion list for shared drives.
  • EXCLUDED_FOLDER_IDS: A list of folder IDs to exclude from search. Use an empty list [] if you aren't setting an exclusion list for folders.

Remove filters from a data store

When managing your data store configuration, you might need to clear specific filters or reset all filters. You can remove filters from an existing data store using the Google Cloud console or API.

Console

To remove existing filter configurations:
  1. In the Google Cloud console navigation menu, click Data stores.
  2. Select your Google Drive data store.
  3. Click View/edit parameters.
  4. In the View/edit parameters panel, delete the folder IDs or shared drive IDs from the filters that you want to remove.
  5. Click Save.

REST

To remove filters from an existing Google Drive data store, call the updateDataConnector method.

Remove a specific filter

To remove a specific filter while keeping others, send an update request. Include the filter lists that you want to retain and set an empty list [] for the filter that you want to remove.

For example, to remove the folder inclusion list while retaining the shared drive inclusion list, use the following command:


    curl -X PATCH \
        -H "Authorization: Bearer $(gcloud auth print-access-token)" \
        -H "Content-Type: application/json" \
        -H "X-Goog-User-Project: PROJECT_ID" \
        "https://ENDPOINT_LOCATION-discoveryengine.googleapis.com/v1alpha/projects/PROJECT_ID/locations/LOCATION/collections/COLLECTION_ID/dataConnector?updateMask=params" \
        -d '{
          "params": {
            "admin_filter": {
              "SharedDriveIds": INCLUDED_SHARED_DRIVE_IDS,
              "FolderIds": []
            }
          }
        }'
    

Replace the following:

  • PROJECT_ID: Your project ID.
  • ENDPOINT_LOCATION: The region of your application. For example, us or eu.
  • LOCATION: The location of your data connector. It must be global or us.
  • COLLECTION_ID: The ID of the collection that contains your data connector. The collection ID is provided when you create a data store. The collection ID isn't the same as the data store ID.
  • INCLUDED_SHARED_DRIVE_IDS: A list of shared drive IDs to include in search, for example ["0ABCdEfGhIjKlMnOpQ"].

Remove all filters

To remove all filters from the data store, send an update request with empty lists for every filter under both admin_filter and admin_exclusion_filter:


    curl -X PATCH \
        -H "Authorization: Bearer $(gcloud auth print-access-token)" \
        -H "Content-Type: application/json" \
        -H "X-Goog-User-Project: PROJECT_ID" \
        "https://ENDPOINT_LOCATION-discoveryengine.googleapis.com/v1alpha/projects/PROJECT_ID/locations/LOCATION/collections/COLLECTION_ID/dataConnector?updateMask=params" \
        -d '{
          "params": {
            "admin_filter": {
              "SharedDriveIds": [],
              "FolderIds": []
            },
            "admin_exclusion_filter": {
              "SharedDriveIds": [],
              "FolderIds": []
            }
          }
        }'
    

Replace the following:

  • PROJECT_ID: Your project ID.
  • ENDPOINT_LOCATION: The region of your application. For example, us or eu.
  • LOCATION: The location of your data connector. It must be global or us.
  • COLLECTION_ID: The ID of the collection that contains your data connector. The collection ID is provided when you create a data store. The collection ID isn't the same as the data store ID.

What's next