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

************
search_index
************



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

  

  The query search index.

   

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


  **Request Syntax**
  ::

    response = client.search_index(
        indexName='string',
        queryString='string',
        nextToken='string',
        maxResults=123,
        queryVersion='string'
    )
    
  :type indexName: string
  :param indexName: 

    The search index name.

    

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

    The search query string. For more information about the search query syntax, see `Query syntax <https://docs.aws.amazon.com/iot/latest/developerguide/query-syntax.html>`__.

    

  
  :type nextToken: string
  :param nextToken: 

    The token used to get the next set of results, or ``null`` if there are no additional results.

    

  
  :type maxResults: integer
  :param maxResults: 

    The maximum number of results to return per page at one time. This maximum number cannot exceed 100. The response might contain fewer results but will never contain more. You can use `nextToken <https://docs.aws.amazon.com/iot/latest/apireference/API_SearchIndex.html#iot-SearchIndex-request-nextToken>`__ to retrieve the next set of results until ``nextToken`` returns ``NULL``.

    

  
  :type queryVersion: string
  :param queryVersion: 

    The query version.

    

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

    
    ::

      {
          'nextToken': 'string',
          'things': [
              {
                  'thingName': 'string',
                  'thingId': 'string',
                  'thingTypeName': 'string',
                  'thingGroupNames': [
                      'string',
                  ],
                  'attributes': {
                      'string': 'string'
                  },
                  'shadow': 'string',
                  'deviceDefender': 'string',
                  'connectivity': {
                      'connected': True|False,
                      'timestamp': 123,
                      'disconnectReason': 'string'
                  }
              },
          ],
          'thingGroups': [
              {
                  'thingGroupName': 'string',
                  'thingGroupId': 'string',
                  'thingGroupDescription': 'string',
                  'attributes': {
                      'string': 'string'
                  },
                  'parentGroupNames': [
                      'string',
                  ]
              },
          ]
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **nextToken** *(string) --* 

        The token used to get the next set of results, or ``null`` if there are no additional results.

        
      

      - **things** *(list) --* 

        The things that match the search query.

        
        

        - *(dict) --* 

          The thing search index document.

          
          

          - **thingName** *(string) --* 

            The thing name.

            
          

          - **thingId** *(string) --* 

            The thing ID.

            
          

          - **thingTypeName** *(string) --* 

            The thing type name.

            
          

          - **thingGroupNames** *(list) --* 

            Thing group and billing group names.

            
            

            - *(string) --* 
        
          

          - **attributes** *(dict) --* 

            The attributes.

            
            

            - *(string) --* 
              

              - *(string) --* 
        
      
          

          - **shadow** *(string) --* 

            The unnamed shadow and named shadow.

             

            For more information about shadows, see `IoT Device Shadow service. <https://docs.aws.amazon.com/iot/latest/developerguide/iot-device-shadows.html>`__

            
          

          - **deviceDefender** *(string) --* 

            Contains Device Defender data.

             

            For more information about Device Defender, see `Device Defender <https://docs.aws.amazon.com/iot/latest/developerguide/device-defender.html>`__.

            
          

          - **connectivity** *(dict) --* 

            Indicates whether the thing is connected to the Amazon Web Services IoT Core service.

            
            

            - **connected** *(boolean) --* 

              True if the thing is connected to the Amazon Web Services IoT Core service; false if it is not connected.

              
            

            - **timestamp** *(integer) --* 

              The epoch time (in milliseconds) when the thing last connected or disconnected. If the thing has been disconnected for approximately an hour, the time value might be missing.

              
            

            - **disconnectReason** *(string) --* 

              The reason why the client is disconnected. If the thing has been disconnected for approximately an hour, the ``disconnectReason`` value might be missing.

              
        
      
    
      

      - **thingGroups** *(list) --* 

        The thing groups that match the search query.

        
        

        - *(dict) --* 

          The thing group search index document.

          
          

          - **thingGroupName** *(string) --* 

            The thing group name.

            
          

          - **thingGroupId** *(string) --* 

            The thing group ID.

            
          

          - **thingGroupDescription** *(string) --* 

            The thing group description.

            
          

          - **attributes** *(dict) --* 

            The thing group attributes.

            
            

            - *(string) --* 
              

              - *(string) --* 
        
      
          

          - **parentGroupNames** *(list) --* 

            Parent group names.

            
            

            - *(string) --* 
        
      
    
  
  **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.IndexNotReadyException`

  