Runs an aggregation query.

Scopes

You will need authorization for at least one of the following scopes to make a valid call:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/datastore

If unset, the scope for this method defaults to https://www.googleapis.com/auth/cloud-platform. You can set the scope for this method like this: datastore1 --scope <scope> projects run-aggregation-query ...

Required Scalar Argument

  • <project-id> (string)
    • Required. The ID of the project against which to make the request.

Required Request Value

The request value is a data-structure with various fields. Each field may be a simple scalar or another data-structure. In the latter case it is advised to set the field-cursor to the data-structure's field to specify values more concisely.

For example, a structure like this:

RunAggregationQueryRequest:
  aggregation-query:
    nested-query:
      end-cursor: string
      filter:
        composite-filter:
          op: string
        property-filter:
          op: string
          property:
            name: string
          value:
            blob-value: string
            boolean-value: boolean
            double-value: number
            entity-value:
              key:
                partition-id:
                  database-id: string
                  namespace-id: string
                  project-id: string
            exclude-from-indexes: boolean
            geo-point-value:
              latitude: number
              longitude: number
            integer-value: string
            key-value:
              partition-id:
                database-id: string
                namespace-id: string
                project-id: string
            meaning: integer
            null-value: string
            string-value: string
            timestamp-value: string
      limit: integer
      offset: integer
      start-cursor: string
  database-id: string
  gql-query:
    allow-literals: boolean
    query-string: string
  partition-id:
    database-id: string
    namespace-id: string
    project-id: string
  read-options:
    new-transaction:
      read-only:
        read-time: string
      read-write:
        previous-transaction: string
    read-consistency: string
    read-time: string
    transaction: string

can be set completely with the following arguments which are assumed to be executed in the given order. Note how the cursor position is adjusted to the respective structures, allowing simple field names to be used most of the time.

  • -r .aggregation-query.nested-query end-cursor=est
  • filter.composite-filter op=gubergren

    • The operator for combining multiple filters.
  • ..property-filter op=ea

    • The operator to filter by.
  • property name=dolor

    • A reference to a property. Requires: * MUST be a dot-delimited (.) string of segments, where each segment conforms to entity property name limitations.
  • ..value blob-value=lorem

    • A blob value. May have at most 1,000,000 bytes. When exclude_from_indexes is false, may have at most 1500 bytes. In JSON requests, must be base64-encoded.
  • boolean-value=false
    • A boolean value.
  • double-value=0.46093367968783205
    • A double value.
  • entity-value.key.partition-id database-id=sed
    • If not empty, the ID of the database to which the entities belong.
  • namespace-id=no
    • If not empty, the ID of the namespace to which the entities belong.
  • project-id=stet

    • The ID of the project to which the entities belong.
  • .... exclude-from-indexes=true

    • If the value should be excluded from all indexes including those defined explicitly.
  • geo-point-value latitude=0.6034145300452126
    • The latitude in degrees. It must be in the range [-90.0, +90.0].
  • longitude=0.8039909988714865

    • The longitude in degrees. It must be in the range [-180.0, +180.0].
  • .. integer-value=erat

    • An integer value.
  • key-value.partition-id database-id=sed
    • If not empty, the ID of the database to which the entities belong.
  • namespace-id=duo
    • If not empty, the ID of the namespace to which the entities belong.
  • project-id=dolore

    • The ID of the project to which the entities belong.
  • ... meaning=79

    • The meaning field should only be populated for backwards compatibility.
  • null-value=voluptua.
    • A null value.
  • string-value=amet.
    • A UTF-8 encoded string value. When exclude_from_indexes is false (it is indexed) , may have at most 1500 bytes. Otherwise, may be set to at most 1,000,000 bytes.
  • timestamp-value=consetetur

    • A timestamp value. When stored in the Datastore, precise only to microseconds; any additional precision is rounded down.
  • .... limit=9

    • The maximum number of results to return. Applies after all other constraints. Optional. Unspecified is interpreted as no limit. Must be >= 0 if specified.
  • offset=52
    • The number of results to skip. Applies before limit, but after all other constraints. Optional. Must be >= 0 if specified.
  • start-cursor=et

  • ... database-id=et

    • The ID of the database against which to make the request. '(default)' is not allowed; please use empty string '' to refer the default database.
  • gql-query allow-literals=false
    • When false, the query string must not contain any literals and instead must bind all values. For example, SELECT * FROM Kind WHERE a = &#39;string literal&#39; is not allowed, while SELECT * FROM Kind WHERE a = @value is.
  • query-string=stet

    • A string of the format described here.
  • ..partition-id database-id=dolor

    • If not empty, the ID of the database to which the entities belong.
  • namespace-id=duo
    • If not empty, the ID of the namespace to which the entities belong.
  • project-id=vero

    • The ID of the project to which the entities belong.
  • ..read-options.new-transaction.read-only read-time=vero

    • Reads entities 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.
  • ..read-write previous-transaction=invidunt

    • The transaction identifier of the transaction being retried.
  • ... read-consistency=stet

    • The non-transactional read consistency to use.
  • read-time=vero
    • Reads entities as they were at the given time. This value is only supported for Cloud Firestore in Datastore mode. 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.
  • transaction=elitr
    • The identifier of the transaction in which to read. A transaction identifier is returned by a call to Datastore.BeginTransaction.

About Cursors

The cursor position is key to comfortably set complex nested structures. The following rules apply:

  • The cursor position is always set relative to the current one, unless the field name starts with the . character. Fields can be nested such as in -r f.s.o .
  • The cursor position is set relative to the top-level structure if it starts with ., e.g. -r .s.s
  • You can also set nested fields without setting the cursor explicitly. For example, to set a value relative to the current cursor position, you would specify -r struct.sub_struct=bar.
  • You can move the cursor one level up by using ... Each additional . moves it up one additional level. E.g. ... would go three levels up.

Optional Output Flags

The method's return value a JSON encoded structure, which will be written to standard output by default.

  • -o out
    • out specifies the destination to which to write the server's result to. It will be a JSON-encoded structure. The destination may be - to indicate standard output, or a filepath that is to contain the received bytes. If unset, it defaults to standard output.

Optional General Properties

The following properties can configure any call, and are not specific to this method.

  • -p $-xgafv=string

    • V1 error format.
  • -p access-token=string

    • OAuth access token.
  • -p alt=string

    • Data format for response.
  • -p callback=string

    • JSONP
  • -p fields=string

    • Selector specifying which fields to include in a partial response.
  • -p key=string

    • API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
  • -p oauth-token=string

    • OAuth 2.0 token for the current user.
  • -p pretty-print=boolean

    • Returns response with indentations and line breaks.
  • -p quota-user=string

    • Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
  • -p upload-type=string

    • Legacy upload protocol for media (e.g. "media", "multipart").
  • -p upload-protocol=string

    • Upload protocol for media (e.g. "raw", "multipart").