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

***************
get_cardinality
***************



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

  

  Returns the approximate count of unique values that match the query.

   

  Requires permission to access the `GetCardinality <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/GetCardinality>`_  


  **Request Syntax**
  ::

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

    The name of the index to search.

    

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

    The search query string.

    

  
  :type aggregationField: string
  :param aggregationField: 

    The field to aggregate.

    

  
  :type queryVersion: string
  :param queryVersion: 

    The query version.

    

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

    
    ::

      {
          'cardinality': 123
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **cardinality** *(integer) --* 

        The approximate count of unique values that match the query.

        
  
  **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`

  