:doc:`IoT <../../iot>` / Client / get_statistics

**************
get_statistics
**************



.. py:method:: IoT.Client.get_statistics(**kwargs)

  

  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 <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions>`__ action.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/iot-2015-05-28/GetStatistics>`_  


  **Request Syntax**
  ::

    response = client.get_statistics(
        indexName='string',
        queryString='string',
        aggregationField='string',
        queryVersion='string'
    )
    
  :type indexName: string
  :param indexName: 

    The name of the index to search. The default value is ``AWS_Things``.

    

  
  :type queryString: string
  :param queryString: **[REQUIRED]** 

    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.

    

  
  :type aggregationField: string
  :param aggregationField: 

    The aggregation field name.

    

  
  :type queryVersion: string
  :param queryVersion: 

    The version of the query used to search.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'statistics': {
              'count': 123,
              'average': 123.0,
              'sum': 123.0,
              'minimum': 123.0,
              'maximum': 123.0,
              'sumOfSquares': 123.0,
              'variance': 123.0,
              'stdDeviation': 123.0
          }
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **statistics** *(dict) --* 

        The statistics returned by the Fleet Indexing service based on the query and aggregation field.

        
        

        - **count** *(integer) --* 

          The count of things that match the query string criteria and contain a valid aggregation field value.

          
        

        - **average** *(float) --* 

          The average of the aggregated field values.

          
        

        - **sum** *(float) --* 

          The sum of the aggregated field values.

          
        

        - **minimum** *(float) --* 

          The minimum aggregated field value.

          
        

        - **maximum** *(float) --* 

          The maximum aggregated field value.

          
        

        - **sumOfSquares** *(float) --* 

          The sum of the squares of the aggregated field values.

          
        

        - **variance** *(float) --* 

          The variance of the aggregated field values.

          
        

        - **stdDeviation** *(float) --* 

          The standard deviation of the aggregated field values.

          
    
  
  **Exceptions**
  
  *   :py:class:`IoT.Client.exceptions.InvalidRequestException`

  
  *   :py:class:`IoT.Client.exceptions.ThrottlingException`

  
  *   :py:class:`IoT.Client.exceptions.UnauthorizedException`

  
  *   :py:class:`IoT.Client.exceptions.ServiceUnavailableException`

  
  *   :py:class:`IoT.Client.exceptions.InternalFailureException`

  
  *   :py:class:`IoT.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`IoT.Client.exceptions.InvalidQueryException`

  
  *   :py:class:`IoT.Client.exceptions.InvalidAggregationException`

  
  *   :py:class:`IoT.Client.exceptions.IndexNotReadyException`

  