Reference documentation and code samples for the Cloud Firestore V1 Client class Index.
Cloud Firestore indexes enable simple and complex queries against
documents in a database.
Generated from protobuf messagegoogle.firestore.admin.v1.Index
Namespace
Google \ Cloud \ Firestore \ Admin \ V1
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ name
string
Output only. A server defined name for this index. The form of this name for composite indexes will be:projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{composite_index_id}For single field indexes, this field will be empty.
↳ query_scope
int
Indexes with a collection query scope specified allow queries against a collection that is the child of a specific document, specified at query time, and that has the same collection ID. Indexes with a collection group query scope specified allow queries against all collections descended from a specific document, specified at query time, and that have the same collection ID as this index.
The fields supported by this index. For composite indexes, this requires a minimum of 2 and a maximum of 100 fields. The last field entry is always for the field path__name__. If, on creation,__name__was not specified as the last field, it will be added automatically with the same direction as that of the last field defined. If the final field in a composite index is not directional, the__name__will be ordered ASCENDING (unless explicitly specified). For single field indexes, this will always be exactly one entry with a field path equal to the field path of the associated field.
↳ state
int
Output only. The serving state of the index.
↳ density
int
Immutable. The density configuration of the index.
↳ multikey
bool
Optional. Whether the index is multikey. By default, the index is not multikey. For non-multikey indexes, none of the paths in the index definition reach or traverse an array, except via an explicit array index. For multikey indexes, at most one of the paths in the index definition reach or traverse an array, except via an explicit array index. Violations will result in errors. Note this field only applies to index with MONGODB_COMPATIBLE_API ApiScope.
↳ shard_count
int
Optional. The number of shards for the index.
getName
Output only. A server defined name for this index.
The form of this name for composite indexes will be:projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{composite_index_id}For single field indexes, this field will be empty.
Returns
Type
Description
string
setName
Output only. A server defined name for this index.
The form of this name for composite indexes will be:projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{composite_index_id}For single field indexes, this field will be empty.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getQueryScope
Indexes with a collection query scope specified allow queries
against a collection that is the child of a specific document, specified at
query time, and that has the same collection ID.
Indexes with a collection group query scope specified allow queries against
all collections descended from a specific document, specified at query
time, and that have the same collection ID as this index.
Returns
Type
Description
int
setQueryScope
Indexes with a collection query scope specified allow queries
against a collection that is the child of a specific document, specified at
query time, and that has the same collection ID.
Indexes with a collection group query scope specified allow queries against
all collections descended from a specific document, specified at query
time, and that have the same collection ID as this index.
Parameter
Name
Description
var
int
Returns
Type
Description
$this
getApiScope
The API scope supported by this index.
Returns
Type
Description
int
setApiScope
The API scope supported by this index.
Parameter
Name
Description
var
int
Returns
Type
Description
$this
getFields
The fields supported by this index.
For composite indexes, this requires a minimum of 2 and a maximum of 100
fields. The last field entry is always for the field path__name__. If,
on creation,__name__was not specified as the last field, it will be
added automatically with the same direction as that of the last field
defined. If the final field in a composite index is not directional, the__name__will be ordered ASCENDING (unless explicitly specified).
For single field indexes, this will always be exactly one entry with a
field path equal to the field path of the associated field.
For composite indexes, this requires a minimum of 2 and a maximum of 100
fields. The last field entry is always for the field path__name__. If,
on creation,__name__was not specified as the last field, it will be
added automatically with the same direction as that of the last field
defined. If the final field in a composite index is not directional, the__name__will be ordered ASCENDING (unless explicitly specified).
For single field indexes, this will always be exactly one entry with a
field path equal to the field path of the associated field.
Immutable. The density configuration of the index.
Returns
Type
Description
int
setDensity
Immutable. The density configuration of the index.
Parameter
Name
Description
var
int
Returns
Type
Description
$this
getMultikey
Optional. Whether the index is multikey. By default, the index is not
multikey. For non-multikey indexes, none of the paths in the index
definition reach or traverse an array, except via an explicit array index.
For multikey indexes, at most one of the paths in the index definition
reach or traverse an array, except via an explicit array index. Violations
will result in errors.
Note this field only applies to index with MONGODB_COMPATIBLE_API ApiScope.
Returns
Type
Description
bool
setMultikey
Optional. Whether the index is multikey. By default, the index is not
multikey. For non-multikey indexes, none of the paths in the index
definition reach or traverse an array, except via an explicit array index.
For multikey indexes, at most one of the paths in the index definition
reach or traverse an array, except via an explicit array index. Violations
will result in errors.
Note this field only applies to index with MONGODB_COMPATIBLE_API ApiScope.
[[["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-04 UTC."],[],[],null,["# Cloud Firestore V1 Client - Class Index (1.53.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.53.0 (latest)](/php/docs/reference/cloud-firestore/latest/Admin.V1.Index)\n- [1.52.0](/php/docs/reference/cloud-firestore/1.52.0/Admin.V1.Index)\n- [1.51.0](/php/docs/reference/cloud-firestore/1.51.0/Admin.V1.Index)\n- [1.50.0](/php/docs/reference/cloud-firestore/1.50.0/Admin.V1.Index)\n- [1.48.1](/php/docs/reference/cloud-firestore/1.48.1/Admin.V1.Index)\n- [1.47.3](/php/docs/reference/cloud-firestore/1.47.3/Admin.V1.Index)\n- [1.46.0](/php/docs/reference/cloud-firestore/1.46.0/Admin.V1.Index)\n- [1.45.2](/php/docs/reference/cloud-firestore/1.45.2/Admin.V1.Index)\n- [1.44.1](/php/docs/reference/cloud-firestore/1.44.1/Admin.V1.Index)\n- [1.43.3](/php/docs/reference/cloud-firestore/1.43.3/Admin.V1.Index)\n- [1.40.0](/php/docs/reference/cloud-firestore/1.40.0/Admin.V1.Index)\n- [1.39.0](/php/docs/reference/cloud-firestore/1.39.0/Admin.V1.Index)\n- [1.38.0](/php/docs/reference/cloud-firestore/1.38.0/Admin.V1.Index)\n- [1.37.7](/php/docs/reference/cloud-firestore/1.37.7/Admin.V1.Index)\n- [1.36.1](/php/docs/reference/cloud-firestore/1.36.1/Admin.V1.Index)\n- [1.35.0](/php/docs/reference/cloud-firestore/1.35.0/Admin.V1.Index)\n- [1.34.0](/php/docs/reference/cloud-firestore/1.34.0/Admin.V1.Index)\n- [1.33.0](/php/docs/reference/cloud-firestore/1.33.0/Admin.V1.Index)\n- [1.32.0](/php/docs/reference/cloud-firestore/1.32.0/Admin.V1.Index)\n- [1.31.0](/php/docs/reference/cloud-firestore/1.31.0/Admin.V1.Index)\n- [1.30.0](/php/docs/reference/cloud-firestore/1.30.0/Admin.V1.Index)\n- [1.28.0](/php/docs/reference/cloud-firestore/1.28.0/Admin.V1.Index)\n- [1.27.3](/php/docs/reference/cloud-firestore/1.27.3/Admin.V1.Index) \nReference documentation and code samples for the Cloud Firestore V1 Client class Index.\n\nCloud Firestore indexes enable simple and complex queries against\ndocuments in a database.\n\nGenerated from protobuf message `google.firestore.admin.v1.Index`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Firestore \\\\ Admin \\\\ V1\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getName\n\nOutput only. A server defined name for this index.\n\nThe form of this name for composite indexes will be:\n`projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{composite_index_id}`\nFor single field indexes, this field will be empty.\n\n### setName\n\nOutput only. A server defined name for this index.\n\nThe form of this name for composite indexes will be:\n`projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{composite_index_id}`\nFor single field indexes, this field will be empty.\n\n### getQueryScope\n\nIndexes with a collection query scope specified allow queries\nagainst a collection that is the child of a specific document, specified at\nquery time, and that has the same collection ID.\n\nIndexes with a collection group query scope specified allow queries against\nall collections descended from a specific document, specified at query\ntime, and that have the same collection ID as this index.\n\n### setQueryScope\n\nIndexes with a collection query scope specified allow queries\nagainst a collection that is the child of a specific document, specified at\nquery time, and that has the same collection ID.\n\nIndexes with a collection group query scope specified allow queries against\nall collections descended from a specific document, specified at query\ntime, and that have the same collection ID as this index.\n\n### getApiScope\n\nThe API scope supported by this index.\n\n### setApiScope\n\nThe API scope supported by this index.\n\n### getFields\n\nThe fields supported by this index.\n\nFor composite indexes, this requires a minimum of 2 and a maximum of 100\nfields. The last field entry is always for the field path `__name__`. If,\non creation, `__name__` was not specified as the last field, it will be\nadded automatically with the same direction as that of the last field\ndefined. If the final field in a composite index is not directional, the\n`__name__` will be ordered ASCENDING (unless explicitly specified).\nFor single field indexes, this will always be exactly one entry with a\nfield path equal to the field path of the associated field.\n\n### setFields\n\nThe fields supported by this index.\n\nFor composite indexes, this requires a minimum of 2 and a maximum of 100\nfields. The last field entry is always for the field path `__name__`. If,\non creation, `__name__` was not specified as the last field, it will be\nadded automatically with the same direction as that of the last field\ndefined. If the final field in a composite index is not directional, the\n`__name__` will be ordered ASCENDING (unless explicitly specified).\nFor single field indexes, this will always be exactly one entry with a\nfield path equal to the field path of the associated field.\n\n### getState\n\nOutput only. The serving state of the index.\n\n### setState\n\nOutput only. The serving state of the index.\n\n### getDensity\n\nImmutable. The density configuration of the index.\n\n### setDensity\n\nImmutable. The density configuration of the index.\n\n### getMultikey\n\nOptional. Whether the index is multikey. By default, the index is not\nmultikey. For non-multikey indexes, none of the paths in the index\ndefinition reach or traverse an array, except via an explicit array index.\n\nFor multikey indexes, at most one of the paths in the index definition\nreach or traverse an array, except via an explicit array index. Violations\nwill result in errors.\nNote this field only applies to index with MONGODB_COMPATIBLE_API ApiScope.\n\n### setMultikey\n\nOptional. Whether the index is multikey. By default, the index is not\nmultikey. For non-multikey indexes, none of the paths in the index\ndefinition reach or traverse an array, except via an explicit array index.\n\nFor multikey indexes, at most one of the paths in the index definition\nreach or traverse an array, except via an explicit array index. Violations\nwill result in errors.\nNote this field only applies to index with MONGODB_COMPATIBLE_API ApiScope.\n\n### getShardCount\n\nOptional. The number of shards for the index.\n\n### setShardCount\n\nOptional. The number of shards for the index."]]