Add filters to a Google Chat data store

This page explains how to add filters to your Google Chat data stores in Gemini Enterprise. Filters determine which information is retrieved or excluded from the Google Chat data store when users chat with the Assistant using the Gemini Enterprise app.

Filter types

The Google Chat data store supports the following filter types:

  • Message Recency: This filter limits search results to a specific timeframe to ensure data relevance and reduce noise. For example, setting the value to 90 days will include only messages from the last 90 days in the index, automatically excluding older data.
  • Exclude Direct Messages: This filter excludes all private 1:1 direct messages from the search results. When enabled, the Google Chat data store only indexes content from multi-user spaces and group chats.

Update filters in an existing data store

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

Console

To modify existing filter configurations:
  1. In the Google Cloud console navigation menu, click Data stores.
  2. Select your Google Chat data store.
  3. Click View/edit parameters.
  4. In the View/edit parameters panel, add or update the filter types.
  5. Click Save.

REST

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

In the request body, you must include all filters that you want in the data store, including filters that you are not 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": { "ExcludeDirectMessages": EXCLUDE_DMS, "MessageRecency": RECENCY_DAYS } } }'

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 either 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 is not the same as the data store ID.
  • EXCLUDE_DMS: A boolean value (true or false).
  • RECENCY_DAYS: An integer representing the age limit in days. For example, 90.

Remove filters from a data store

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

Console

To remove existing filter configurations:
  1. In the Google Cloud console navigation menu, click Data stores.
  2. Select your Google Chat data store.
  3. Click View/edit parameters.
  4. In the View/edit parameters panel, delete the filter types.
  5. Click Save.

REST

Remove a specific filter

To remove a specific filter while keeping others, send an **update request**. Within the admin_filter object in the params attribute, include only the filters you want to retain. Any filter that is not listed will be removed.

For example, to remove MessageRecency but retain ExcludeDirectMessages, use the following command:


    {
      "params": {
        "admin_filter": {
          "ExcludeDirectMessages": EXCLUDE_DMS
        }
      }
    }
    

Replace the following:

  • EXCLUDE_DMS: A boolean value (true or false).

Remove all filters

To remove all filters from the data store, use the remove_param_keys attribute in an update request. This deletes the entire admin_filter key and its associated logic.


    {
      "remove_param_keys": "admin_filter"
    }
    

What's next