Skip to content

get_buckets_aggregation async

get_buckets_aggregation(
    query_string: QueryString,
    aggregation_field: AggregationField,
    buckets_aggregation_type: BucketsAggregationType,
    *,
    config_overrides: Optional[AsyncIoTClientConfig] = None,
    index_name: Optional[IndexName] = None,
    query_version: Optional[QueryVersion] = None,
) -> GetBucketsAggregationResponse

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

Requires permission to access the GetBucketsAggregation action.

Parameters:

  • index_name (Optional[IndexName], default: None ) –

    The name of the index to search.

  • query_string (QueryString) –

    The search query string.

  • aggregation_field (AggregationField) –

    The aggregation field.

  • query_version (Optional[QueryVersion], default: None ) –

    The version of the query.

  • buckets_aggregation_type (BucketsAggregationType) –

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

Raises:

Source code in docs_src/capo_iot/_services/async_io_t.py
async def get_buckets_aggregation(
    self,
    query_string: "capo_iot.types.query_string.QueryString",
    aggregation_field: "capo_iot.types.aggregation_field.AggregationField",
    buckets_aggregation_type: "capo_iot.types.buckets_aggregation_type.BucketsAggregationType",
    *,
    config_overrides: Optional[AsyncIoTClientConfig] = None,
    index_name: Optional["capo_iot.types.index_name.IndexName"] = None,
    query_version: Optional["capo_iot.types.query_version.QueryVersion"] = None,
) -> (
    "capo_iot.types.get_buckets_aggregation_response.GetBucketsAggregationResponse"
):
    """<p>Aggregates on indexed data with search queries pertaining to particular fields. </p> <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">GetBucketsAggregation</a> action.</p>

    Args:
        index_name: <p>The name of the index to search.</p>
        query_string: <p>The search query string.</p>
        aggregation_field: <p>The aggregation field.</p>
        query_version: <p>The version of the query.</p>
        buckets_aggregation_type: <p>The basic control of the response shape and the bucket aggregation type to perform. </p>

    Raises:
        capo_iot.errors.index_not_ready_exception.IndexNotReadyException: <p>The index is not ready.</p>
        capo_iot.errors.internal_failure_exception.InternalFailureException: <p>An unexpected error has occurred.</p>
        capo_iot.errors.invalid_aggregation_exception.InvalidAggregationException: <p>The aggregation is invalid.</p>
        capo_iot.errors.invalid_query_exception.InvalidQueryException: <p>The query is invalid.</p>
        capo_iot.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
        capo_iot.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_iot.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is temporarily unavailable.</p>
        capo_iot.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
        capo_iot.errors.unauthorized_exception.UnauthorizedException: <p>You are not authorized to perform this operation.</p>
        capo_iot.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_iot.types.get_buckets_aggregation_request.GetBucketsAggregationRequest]",
    ) -> AsyncOperationResponse[
        "capo_iot.types.get_buckets_aggregation_response.GetBucketsAggregationResponse"
    ]:
        import capo_iot._operations.aws_iot_service.get_buckets_aggregation

        (
            output,
            http_response,
        ) = await capo_iot._operations.aws_iot_service.get_buckets_aggregation.async_get_buckets_aggregation(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetBucketsAggregation")
    )
    input_: capo_iot.types.get_buckets_aggregation_request.GetBucketsAggregationRequest = {
        "query_string": query_string,
        "aggregation_field": aggregation_field,
        "buckets_aggregation_type": buckets_aggregation_type,
    }
    if index_name is not None:
        input_["index_name"] = index_name
    if query_version is not None:
        input_["query_version"] = query_version

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output