Skip to content

search_index async

search_index(
    query_string: QueryString,
    *,
    config_overrides: Optional[AsyncIoTClientConfig] = None,
    index_name: Optional[IndexName] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[SearchQueryMaxResults] = None,
    query_version: Optional[QueryVersion] = None,
) -> SearchIndexResponse

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.

Parameters:

  • index_name (Optional[IndexName], default: None ) –

    The search index name.

  • query_string (QueryString) –

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

  • next_token (Optional[NextToken], default: None ) –

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

  • max_results (Optional[SearchQueryMaxResults], default: None ) –

    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.

  • query_version (Optional[QueryVersion], default: None ) –

    The query version.

Raises:

Source code in docs_src/capo_iot/_services/async_io_t.py
async def search_index(
    self,
    query_string: "capo_iot.types.query_string.QueryString",
    *,
    config_overrides: Optional[AsyncIoTClientConfig] = None,
    index_name: Optional["capo_iot.types.index_name.IndexName"] = None,
    next_token: Optional["capo_iot.types.next_token.NextToken"] = None,
    max_results: Optional[
        "capo_iot.types.search_query_max_results.SearchQueryMaxResults"
    ] = None,
    query_version: Optional["capo_iot.types.query_version.QueryVersion"] = None,
) -> "capo_iot.types.search_index_response.SearchIndexResponse":
    """<p>Searches the specified index.</p> <p>If a device has never connected to IoT Core or was disconnected for more than 1 hour before fleet indexing's <code>thingConnectivityIndexingMode</code> was enabled, the <code>connectivity</code> object for this device in the response will have the <code>connected</code> field set to <code>false</code> with no additional session details.</p> <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">SearchIndex</a> action.</p>

    Args:
        index_name: <p>The search index name.</p>
        query_string: <p>The search query string. For more information about the search query syntax, see <a href="https://docs.aws.amazon.com/iot/latest/developerguide/query-syntax.html">Query syntax</a>.</p>
        next_token: <p>The token used to get the next set of results, or <code>null</code> if there are no additional results.</p>
        max_results: <p>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 <a href="https://docs.aws.amazon.com/iot/latest/apireference/API_SearchIndex.html#iot-SearchIndex-request-nextToken"> <code>nextToken</code> </a> to retrieve the next set of results until <code>nextToken</code> returns <code>NULL</code>.</p>
        query_version: <p>The query version.</p>

    Raises:
        capo_iot.errors.index_not_ready_exception.IndexNotReadyException: <p>The index is not ready.</p>
        capo_iot.errors.internal_failure_exception.InternalFailureException: <p>An unexpected error has occurred.</p>
        capo_iot.errors.invalid_query_exception.InvalidQueryException: <p>The query is invalid.</p>
        capo_iot.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
        capo_iot.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_iot.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is temporarily unavailable.</p>
        capo_iot.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
        capo_iot.errors.unauthorized_exception.UnauthorizedException: <p>You are not authorized to perform this operation.</p>
        capo_iot.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_iot.types.search_index_request.SearchIndexRequest]",
    ) -> AsyncOperationResponse[
        "capo_iot.types.search_index_response.SearchIndexResponse"
    ]:
        import capo_iot._operations.aws_iot_service.search_index

        (
            output,
            http_response,
        ) = await capo_iot._operations.aws_iot_service.search_index.async_search_index(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("SearchIndex")
    )
    input_: capo_iot.types.search_index_request.SearchIndexRequest = {
        "query_string": query_string
    }
    if index_name is not None:
        input_["index_name"] = index_name
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if query_version is not None:
        input_["query_version"] = query_version

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output