Partitions a query by returning partition cursors that can be used to run the query in parallel. The returned partition cursors are split points that can be used by documents.runQuery as starting/end points for the query results.
HTTP request
POST https://firestore.googleapis.com/v1/{parent=projects/*/databases/*/documents}:partitionQuery
The URL uses gRPC Transcoding syntax.
Path parameters
Parameters | |
---|---|
parent |
Required. The parent resource name. In the format: |
Request body
The request body contains data with the following structure:
JSON representation |
---|
{ "partitionCount": string, "pageToken": string, "pageSize": integer, // Union field |
Fields | |
---|---|
partitionCount |
The desired maximum number of partition points. The partitions may be returned across multiple pages of results. The number must be positive. The actual number of partitions returned may be fewer. For example, this may be set to one fewer than the number of parallel queries to be run, or in running a data pipeline job, one fewer than the number of workers or compute instances available. |
pageToken |
The For example, two subsequent calls using a pageToken may return:
To obtain a complete result set ordered with respect to the results of the query supplied to documents.partitionQuery, the results sets should be merged: cursor A, cursor B, cursor M, cursor Q, cursor U, cursor W |
pageSize |
The maximum number of partitions to return in this call, subject to For example, if |
Union field query_type . The query to partition. query_type can be only one of the following: |
|
structuredQuery |
A structured query. Query must specify collection with all descendants and be ordered by name ascending. Other filters, order bys, limits, offsets, and start/end cursors are not supported. |
Union field consistency_selector . The consistency mode for this request. If not set, defaults to strong consistency. consistency_selector can be only one of the following: |
|
readTime |
Reads documents as they were at the given time. This must be a microsecond precision timestamp within the past one hour, or if Point-in-Time Recovery is enabled, can additionally be a whole minute timestamp within the past 7 days. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: |
Response body
The response for Firestore.PartitionQuery
.
If successful, the response body contains data with the following structure:
JSON representation |
---|
{
"partitions": [
{
object ( |
Fields | |
---|---|
partitions[] |
Partition results. Each partition is a split point that can be used by documents.runQuery as a starting or end point for the query results. The documents.runQuery requests must be made with the same query supplied to this documents.partitionQuery request. The partition cursors will be ordered according to same ordering as the results of the query supplied to documents.partitionQuery. For example, if a documents.partitionQuery request returns partition cursors A and B, running the following three queries will return the entire result set of the original query:
An empty result may indicate that the query has too few results to be partitioned, or that the query is not yet supported for partitioning. |
nextPageToken |
A page token that may be used to request an additional set of results, up to the number specified by |
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 Authentication Overview.