IoT / Client / get_buckets_aggregation



Aggregates on indexed data with search queries pertaining to particular fields.

Requires permission to access the GetBucketsAggregation action.

See also: AWS API Documentation

Request Syntax

response = client.get_buckets_aggregation(
        'termsAggregation': {
            'maxBuckets': 123
  • indexName (string) – The name of the index to search.

  • queryString (string) –


    The search query string.

  • aggregationField (string) –


    The aggregation field.

  • queryVersion (string) – The version of the query.

  • bucketsAggregationType (dict) –


    The basic control of the response shape and the bucket aggregation type to perform.

    • termsAggregation (dict) –

      Performs an aggregation that will return a list of buckets. The list of buckets is a ranked list of the number of occurrences of an aggregation field value.

      • maxBuckets (integer) –

        The number of buckets to return in the response. Default to 10.

Return type:



Response Syntax

    'totalCount': 123,
    'buckets': [
            'keyValue': 'string',
            'count': 123

Response Structure

  • (dict) –

    • totalCount (integer) –

      The total number of things that fit the query string criteria.

    • buckets (list) –

      The main part of the response with a list of buckets. Each bucket contains a keyValue and a count.

      keyValue: The aggregation field value counted for the particular bucket.

      count: The number of documents that have that value.

      • (dict) –

        A count of documents that meets a specific aggregation criteria.

        • keyValue (string) –

          The value counted for the particular bucket.

        • count (integer) –

          The number of documents that have the value counted for the particular bucket.


  • IoT.Client.exceptions.InvalidRequestException

  • IoT.Client.exceptions.ThrottlingException

  • IoT.Client.exceptions.UnauthorizedException

  • IoT.Client.exceptions.ServiceUnavailableException

  • IoT.Client.exceptions.InternalFailureException

  • IoT.Client.exceptions.ResourceNotFoundException

  • IoT.Client.exceptions.InvalidQueryException

  • IoT.Client.exceptions.InvalidAggregationException

  • IoT.Client.exceptions.IndexNotReadyException