Select your cookie preferences

We use cookies and similar tools to enhance your experience, provide our services, deliver relevant advertising, and make improvements. Approved third parties also use these tools to help us deliver advertising and provide certain site features.

get_query_suggestions

get_query_suggestions(**kwargs)

Fetches the queries that are suggested to your users.

GetQuerySuggestions is currently not supported in the Amazon Web Services GovCloud (US-West) region.

See also: AWS API Documentation

Request Syntax

response = client.get_query_suggestions(
    IndexId='string',
    QueryText='string',
    MaxSuggestionsCount=123
)
Parameters
  • IndexId (string) --

    [REQUIRED]

    The identifier of the index you want to get query suggestions from.

  • QueryText (string) --

    [REQUIRED]

    The text of a user's query to generate query suggestions.

    A query is suggested if the query prefix matches what a user starts to type as their query.

    Amazon Kendra does not show any suggestions if a user types fewer than two characters or more than 60 characters. A query must also have at least one search result and contain at least one word of more than four characters.

  • MaxSuggestionsCount (integer) -- The maximum number of query suggestions you want to show to your users.
Return type

dict

Returns

Response Syntax

{
    'QuerySuggestionsId': 'string',
    'Suggestions': [
        {
            'Id': 'string',
            'Value': {
                'Text': {
                    'Text': 'string',
                    'Highlights': [
                        {
                            'BeginOffset': 123,
                            'EndOffset': 123
                        },
                    ]
                }
            }
        },
    ]
}

Response Structure

  • (dict) --

    • QuerySuggestionsId (string) --

      The identifier for a list of query suggestions for an index.

    • Suggestions (list) --

      A list of query suggestions for an index.

      • (dict) --

        A single query suggestion.

        • Id (string) --

          The UUID (universally unique identifier) of a single query suggestion.

        • Value (dict) --

          The value for the UUID (universally unique identifier) of a single query suggestion.

          The value is the text string of a suggestion.

          • Text (dict) --

            The SuggestionTextWithHighlights structure that contains the query suggestion text and highlights.

            • Text (string) --

              The query suggestion text to display to the user.

            • Highlights (list) --

              The beginning and end of the query suggestion text that should be highlighted.

              • (dict) --

                The text highlights for a single query suggestion.

                • BeginOffset (integer) --

                  The zero-based location in the response string where the highlight starts.

                • EndOffset (integer) --

                  The zero-based location in the response string where the highlight ends.

Exceptions

  • kendra.Client.exceptions.ValidationException
  • kendra.Client.exceptions.ResourceNotFoundException
  • kendra.Client.exceptions.ThrottlingException
  • kendra.Client.exceptions.AccessDeniedException
  • kendra.Client.exceptions.ServiceQuotaExceededException
  • kendra.Client.exceptions.ConflictException
  • kendra.Client.exceptions.InternalServerException