getStatistics method

Future<GetStatisticsResponse> getStatistics({
  1. required String queryString,
  2. String? aggregationField,
  3. String? indexName,
  4. String? queryVersion,
})

Returns the count, average, sum, minimum, maximum, sum of squares, variance, and standard deviation for the specified aggregated field. If the aggregation field is of type String, only the count statistic is returned.

Requires permission to access the GetStatistics action.

May throw IndexNotReadyException. May throw InternalFailureException. May throw InvalidAggregationException. May throw InvalidQueryException. May throw InvalidRequestException. May throw ResourceNotFoundException. May throw ServiceUnavailableException. May throw ThrottlingException. May throw UnauthorizedException.

Parameter queryString : The query used to search. You can specify "*" for the query string to get the count of all indexed things in your Amazon Web Services account.

Parameter aggregationField : The aggregation field name.

Parameter indexName : The name of the index to search. The default value is AWS_Things.

Parameter queryVersion : The version of the query used to search.

Implementation

Future<GetStatisticsResponse> getStatistics({
  required String queryString,
  String? aggregationField,
  String? indexName,
  String? queryVersion,
}) async {
  final $payload = <String, dynamic>{
    'queryString': queryString,
    if (aggregationField != null) 'aggregationField': aggregationField,
    if (indexName != null) 'indexName': indexName,
    if (queryVersion != null) 'queryVersion': queryVersion,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/indices/statistics',
    exceptionFnMap: _exceptionFns,
  );
  return GetStatisticsResponse.fromJson(response);
}