Method: projects.databases.collectionGroups.fields.patch
Stay organized with collections
Save and categorize content based on your preferences.
Updates a field configuration. Currently, field updates apply only to single field index configuration. However, calls to FirestoreAdmin.UpdateField
should provide a field mask to avoid changing any configuration that the caller isn't aware of. The field mask should be specified as: { paths: "indexConfig" }
.
This call returns a google.longrunning.Operation
which may be used to track the status of the field update. The metadata for the operation will be the type FieldOperationMetadata
.
To configure the default field settings for the database, use the special Field
with resource name: projects/{projectId}/databases/{databaseId}/collectionGroups/__default__/fields/*
.
HTTP request
PATCH https://firestore.googleapis.com/v1/{field.name=projects/*/databases/*/collectionGroups/*/fields/*}
The URL uses gRPC Transcoding syntax.
Path parameters
Parameters |
field.name |
string
Required. A field name of the form: projects/{projectId}/databases/{databaseId}/collectionGroups/{collectionId}/fields/{fieldPath} A field path can be a simple field name, e.g. address or a path to fields within mapValue , e.g. address.city , or a special field path. The only valid special field is * , which represents any field. Field paths can be quoted using ` (backtick). The only character that must be escaped within a quoted field path is the backtick character itself, escaped using a backslash. Special characters in field paths that must be quoted include: * , . , ` (backtick), [ , ] , as well as any ascii symbolic characters. Examples: `address.city` represents a field named address.city , not the map key city in the field address . `*` represents a field named * , not any field. A special Field contains the default indexing settings for all fields. This field's resource name is: projects/{projectId}/databases/{databaseId}/collectionGroups/__default__/fields/* Indexes defined on this Field will be applied to all fields which do not have their own Field index configuration.
|
Query parameters
Parameters |
updateMask |
string (FieldMask format)
A mask, relative to the field. If specified, only configuration specified by this field_mask will be updated in the field. This is a comma-separated list of fully qualified names of fields. Example: "user.displayName,photo" .
|
Request body
The request body contains an instance of Field
.
Response body
If successful, the response body contains an instance of Operation
.
Authorization scopes
Requires one of the following OAuth scopes:
https://www.googleapis.com/auth/datastore
https://www.googleapis.com/auth/cloud-platform
For more information, see the OAuth 2.0 Overview.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-06-20 UTC.
[null,null,["Last updated 2025-06-20 UTC."],[],[],null,["# Method: projects.databases.collectionGroups.fields.patch\n\nUpdates a field configuration. Currently, field updates apply only to single field index configuration. However, calls to [FirestoreAdmin.UpdateField](/docs/firestore/reference/rest/v1/projects.databases.collectionGroups.fields/patch#google.firestore.admin.v1.FirestoreAdmin.UpdateField) should provide a field mask to avoid changing any configuration that the caller isn't aware of. The field mask should be specified as: `{ paths: \"indexConfig\" }`.\n\nThis call returns a [google.longrunning.Operation](/docs/firestore/reference/rest/Shared.Types/Operation) which may be used to track the status of the field update. The metadata for the operation will be the type [FieldOperationMetadata](/docs/firestore/reference/rest/Shared.Types/FieldOperationMetadata).\n\nTo configure the default field settings for the database, use the special `Field` with resource name: `projects/{projectId}/databases/{databaseId}/collectionGroups/__default__/fields/*`.\n\n### HTTP request\n\n`PATCH https://firestore.googleapis.com/v1/{field.name=projects/*/databases/*/collectionGroups/*/fields/*}`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `field.name` | `string` Required. A field name of the form: `projects/{projectId}/databases/{databaseId}/collectionGroups/{collectionId}/fields/{fieldPath}` A field path can be a simple field name, e.g. `address` or a path to fields within `mapValue` , e.g. `address.city`, or a special field path. The only valid special field is `*`, which represents any field. Field paths can be quoted using ````` (backtick). The only character that must be escaped within a quoted field path is the backtick character itself, escaped using a backslash. Special characters in field paths that must be quoted include: `*`, `.`, ````` (backtick), `[`, `]`, as well as any ascii symbolic characters. Examples: ```address.city``` represents a field named `address.city`, not the map key `city` in the field `address`. ```*``` represents a field named `*`, not any field. A special `Field` contains the default indexing settings for all fields. This field's resource name is: `projects/{projectId}/databases/{databaseId}/collectionGroups/__default__/fields/*` Indexes defined on this `Field` will be applied to all fields which do not have their own `Field` index configuration. |\n\n### Query parameters\n\n| Parameters ||\n|--------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `updateMask` | `string (`[FieldMask](https://protobuf.dev/reference/protobuf/google.protobuf/#field-mask)` format)` A mask, relative to the field. If specified, only configuration specified by this field_mask will be updated in the field. This is a comma-separated list of fully qualified names of fields. Example: `\"user.displayName,photo\"`. |\n\n### Request body\n\nThe request body contains an instance of [Field](/docs/firestore/reference/rest/v1/projects.databases.collectionGroups.fields#Field).\n\n### Response body\n\nIf successful, the response body contains an instance of [Operation](/docs/firestore/reference/rest/Shared.Types/Operation).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/datastore`\n- `https://www.googleapis.com/auth/cloud-platform`\n\nFor more information, see the [OAuth 2.0 Overview](https://developers.google.com/identity/protocols/OAuth2)."]]