indexes
Creates, updates, deletes, gets or lists an indexes
resource.
Overview
Name | indexes |
Type | Resource |
Id | google.datastore.indexes |
Fields
The following fields are returned by SELECT
queries:
- get
- list
Successful response
Name | Datatype | Description |
---|---|---|
ancestor | string | Required. The index's ancestor mode. Must not be ANCESTOR_MODE_UNSPECIFIED. |
indexId | string | Output only. The resource ID of the index. |
kind | string | Required. The entity kind to which this index applies. |
projectId | string | Output only. Project ID. |
properties | array | Required. An ordered sequence of property names and their index attributes. Requires: * A maximum of 100 properties. |
state | string | Output only. The state of the index. |
Successful response
Name | Datatype | Description |
---|---|---|
ancestor | string | Required. The index's ancestor mode. Must not be ANCESTOR_MODE_UNSPECIFIED. |
indexId | string | Output only. The resource ID of the index. |
kind | string | Required. The entity kind to which this index applies. |
projectId | string | Output only. Project ID. |
properties | array | Required. An ordered sequence of property names and their index attributes. Requires: * A maximum of 100 properties. |
state | string | Output only. The state of the index. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get | select | projectId , indexId | Gets an index. | |
list | select | projectId | filter , pageSize , pageToken | Lists the indexes that match the specified filters. Datastore uses an eventually consistent query to fetch the list of indexes and may occasionally return stale results. |
create | insert | projectId | Creates the specified index. A newly created index's initial state is CREATING . On completion of the returned google.longrunning.Operation, the state will be READY . If the index already exists, the call will return an ALREADY_EXISTS status. During index creation, the process could result in an error, in which case the index will move to the ERROR state. The process can be recovered by fixing the data that caused the error, removing the index with delete, then re-creating the index with create. Indexes with a single property cannot be created. | |
delete | delete | projectId , indexId | Deletes an existing index. An index can only be deleted if it is in a READY or ERROR state. On successful execution of the request, the index will be in a DELETING state. And on completion of the returned google.longrunning.Operation, the index will be removed. During index deletion, the process could result in an error, in which case the index will move to the ERROR state. The process can be recovered by fixing the data that caused the error, followed by calling delete again. |
Parameters
Parameters can be passed in the WHERE
clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
Name | Datatype | Description |
---|---|---|
indexId | string | |
projectId | string | |
filter | string | |
pageSize | integer (int32) | |
pageToken | string |
SELECT
examples
- get
- list
Gets an index.
SELECT
ancestor,
indexId,
kind,
projectId,
properties,
state
FROM google.datastore.indexes
WHERE projectId = '{{ projectId }}' -- required
AND indexId = '{{ indexId }}' -- required;
Lists the indexes that match the specified filters. Datastore uses an eventually consistent query to fetch the list of indexes and may occasionally return stale results.
SELECT
ancestor,
indexId,
kind,
projectId,
properties,
state
FROM google.datastore.indexes
WHERE projectId = '{{ projectId }}' -- required
AND filter = '{{ filter }}'
AND pageSize = '{{ pageSize }}'
AND pageToken = '{{ pageToken }}';
INSERT
examples
- create
- Manifest
Creates the specified index. A newly created index's initial state is CREATING
. On completion of the returned google.longrunning.Operation, the state will be READY
. If the index already exists, the call will return an ALREADY_EXISTS
status. During index creation, the process could result in an error, in which case the index will move to the ERROR
state. The process can be recovered by fixing the data that caused the error, removing the index with delete, then re-creating the index with create. Indexes with a single property cannot be created.
INSERT INTO google.datastore.indexes (
data__kind,
data__ancestor,
data__properties,
projectId
)
SELECT
'{{ kind }}',
'{{ ancestor }}',
'{{ properties }}',
'{{ projectId }}'
RETURNING
name,
done,
error,
metadata,
response
;
# Description fields are for documentation purposes
- name: indexes
props:
- name: projectId
value: string
description: Required parameter for the indexes resource.
- name: kind
value: string
description: >
Required. The entity kind to which this index applies.
- name: ancestor
value: string
description: >
Required. The index's ancestor mode. Must not be ANCESTOR_MODE_UNSPECIFIED.
valid_values: ['ANCESTOR_MODE_UNSPECIFIED', 'NONE', 'ALL_ANCESTORS']
- name: properties
value: array
description: >
Required. An ordered sequence of property names and their index attributes. Requires: * A maximum of 100 properties.
DELETE
examples
- delete
Deletes an existing index. An index can only be deleted if it is in a READY
or ERROR
state. On successful execution of the request, the index will be in a DELETING
state. And on completion of the returned google.longrunning.Operation, the index will be removed. During index deletion, the process could result in an error, in which case the index will move to the ERROR
state. The process can be recovered by fixing the data that caused the error, followed by calling delete again.
DELETE FROM google.datastore.indexes
WHERE projectId = '{{ projectId }}' --required
AND indexId = '{{ indexId }}' --required;