CloudTrail / Client / search_sample_queries

search_sample_queries

CloudTrail.Client.search_sample_queries(**kwargs)

Warning

CloudTrail Lake will no longer be open to new customers starting May 31, 2026. If you would like to use CloudTrail Lake, sign up prior to that date. Existing customers can continue to use the service as normal. For more information, see CloudTrail Lake availability change.

Searches sample queries and returns a list of sample queries that are sorted by relevance. To search for sample queries, provide a natural language SearchPhrase in English.

See also: AWS API Documentation

Request Syntax

response = client.search_sample_queries(
    SearchPhrase='string',
    MaxResults=123,
    NextToken='string'
)
Parameters:
  • SearchPhrase (string) –

    [REQUIRED]

    The natural language phrase to use for the semantic search. The phrase must be in English. The length constraint is in characters, not words.

  • MaxResults (integer) – The maximum number of results to return on a single page. The default value is 10.

  • NextToken (string) – A token you can use to get the next page of results. The length constraint is in characters, not words.

Return type:

dict

Returns:

Response Syntax

{
    'SearchResults': [
        {
            'Name': 'string',
            'Description': 'string',
            'SQL': 'string',
            'Relevance': ...
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) –

    • SearchResults (list) –

      A list of objects containing the search results ordered from most relevant to least relevant.

      • (dict) –

        A search result returned by the SearchSampleQueries operation.

        • Name (string) –

          The name of a sample query.

        • Description (string) –

          A longer description of a sample query.

        • SQL (string) –

          The SQL code of the sample query.

        • Relevance (float) –

          A value between 0 and 1 indicating the similarity between the search phrase and result.

    • NextToken (string) –

      A token you can use to get the next page of results.

Exceptions

  • CloudTrail.Client.exceptions.InvalidParameterException

  • CloudTrail.Client.exceptions.UnsupportedOperationException

  • CloudTrail.Client.exceptions.OperationNotPermittedException