IoT / Client / get_buckets_aggregation

get_buckets_aggregation#

IoT.Client.get_buckets_aggregation(**kwargs)#

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(
    indexName='string',
    queryString='string',
    aggregationField='string',
    queryVersion='string',
    bucketsAggregationType={
        'termsAggregation': {
            'maxBuckets': 123
        }
    }
)
Parameters:
  • indexName (string) – The name of the index to search.

  • queryString (string) –

    [REQUIRED]

    The search query string.

  • aggregationField (string) –

    [REQUIRED]

    The aggregation field.

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

  • bucketsAggregationType (dict) –

    [REQUIRED]

    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:

dict

Returns:

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.

Exceptions