IoT / Client / search_index

search_index

IoT.Client.search_index(**kwargs)

Searches the specified index.

If a device has never connected to IoT Core or was disconnected for more than 1 hour before fleet indexing’s thingConnectivityIndexingMode was enabled, the connectivity object for this device in the response will have the connected field set to false with no additional session details.

Requires permission to access the SearchIndex action.

See also: AWS API Documentation

Request Syntax

response = client.search_index(
    indexName='string',
    queryString='string',
    nextToken='string',
    maxResults=123,
    queryVersion='string'
)
Parameters:
  • indexName (string) – The search index name.

  • queryString (string) –

    [REQUIRED]

    The search query string. For more information about the search query syntax, see Query syntax.

  • nextToken (string) – The token used to get the next set of results, or null if there are no additional results.

  • maxResults (integer) – 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 to retrieve the next set of results until nextToken returns NULL.

  • queryVersion (string) – The query version.

Return type:

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',
                'keepAliveDuration': 123,
                'cleanSession': True|False,
                'sessionExpiry': 123,
                'clientId': '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.

        • deviceDefender (string) –

          Contains Device Defender data.

          For more information about Device Defender, see Device Defender.

        • 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.

          • disconnectReason (string) –

            The reason that the client is disconnected.

          • keepAliveDuration (integer) –

            The keep-alive interval in seconds that the client specified when establishing the connection.

          • cleanSession (boolean) –

            Indicates whether the client is using a clean session. Returns true for clean sessions.

          • sessionExpiry (integer) –

            The session expiry interval in seconds for the MQTT client connection. This value indicates how long the session will remain active after the client disconnects.

          • clientId (string) –

            The unique identifier of the MQTT client.

    • 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