Skip to content

aws.kendra.get_query_suggestions

Example SQL Queries

SELECT * FROM
aws.kendra.get_query_suggestions
WHERE
"index_id" = 'VALUE'
AND "query_text" = 'VALUE';

Description

Fetches the queries that are suggested to your users.

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

Table Definition

Column NameColumn Data Type
index_id Required Input Column

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

VARCHAR
query_text Required Input Column

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.

VARCHAR
attribute_suggestions_config Input Column

Configuration information for the document fields/attributes that you want to base query suggestions on.

STRUCT(
"suggestion_attributes" VARCHAR[],
"additional_response_attributes" VARCHAR[],
"attribute_filter" STRUCT(
"equals_to" STRUCT(
"key" VARCHAR,
"value" STRUCT(
"string_value" VARCHAR,
"string_list_value" VARCHAR[],
"long_value" BIGINT,
"date_value" TIMESTAMP_S
)
),
"contains_all" STRUCT(
"key" VARCHAR,
"value" STRUCT(
"string_value" VARCHAR,
"string_list_value" VARCHAR[],
"long_value" BIGINT,
"date_value" TIMESTAMP_S
)
),
"contains_any" STRUCT(
"key" VARCHAR,
"value" STRUCT(
"string_value" VARCHAR,
"string_list_value" VARCHAR[],
"long_value" BIGINT,
"date_value" TIMESTAMP_S
)
),
"greater_than" STRUCT(
"key" VARCHAR,
"value" STRUCT(
"string_value" VARCHAR,
"string_list_value" VARCHAR[],
"long_value" BIGINT,
"date_value" TIMESTAMP_S
)
),
"greater_than_or_equals" STRUCT(
"key" VARCHAR,
"value" STRUCT(
"string_value" VARCHAR,
"string_list_value" VARCHAR[],
"long_value" BIGINT,
"date_value" TIMESTAMP_S
)
),
"less_than" STRUCT(
"key" VARCHAR,
"value" STRUCT(
"string_value" VARCHAR,
"string_list_value" VARCHAR[],
"long_value" BIGINT,
"date_value" TIMESTAMP_S
)
),
"less_than_or_equals" STRUCT(
"key" VARCHAR,
"value" STRUCT(
"string_value" VARCHAR,
"string_list_value" VARCHAR[],
"long_value" BIGINT,
"date_value" TIMESTAMP_S
)
)
),
"user_context" STRUCT(
"token" VARCHAR,
"user_id" VARCHAR,
"groups" VARCHAR[],
"data_source_groups" STRUCT(
"group_id" VARCHAR,
"data_source_id" VARCHAR
)[]
)
)
Show child fields
attribute_suggestions_config.additional_response_attributes[]
attribute_suggestions_config.attribute_filter

Filters the search results based on document fields/attributes.

Show child fields
attribute_suggestions_config.attribute_filter.contains_all

Returns true when a document contains all of the specified document attributes/fields. This filter is only applicable to StringListValue.

Show child fields
attribute_suggestions_config.attribute_filter.contains_all.key

The identifier for the attribute.

attribute_suggestions_config.attribute_filter.contains_all.value

The value of the attribute.

Show child fields
attribute_suggestions_config.attribute_filter.contains_all.value.date_value

A date expressed as an ISO 8601 string.

It is important for the time zone to be included in the ISO 8601 date-time format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.

attribute_suggestions_config.attribute_filter.contains_all.value.long_value

A long integer value.

attribute_suggestions_config.attribute_filter.contains_all.value.string_list_value[]
attribute_suggestions_config.attribute_filter.contains_all.value.string_value

A string, such as "department".

attribute_suggestions_config.attribute_filter.contains_any

Returns true when a document contains any of the specified document attributes/fields. This filter is only applicable to StringListValue.

Show child fields
attribute_suggestions_config.attribute_filter.contains_any.key

The identifier for the attribute.

attribute_suggestions_config.attribute_filter.contains_any.value

The value of the attribute.

Show child fields
attribute_suggestions_config.attribute_filter.contains_any.value.date_value

A date expressed as an ISO 8601 string.

It is important for the time zone to be included in the ISO 8601 date-time format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.

attribute_suggestions_config.attribute_filter.contains_any.value.long_value

A long integer value.

attribute_suggestions_config.attribute_filter.contains_any.value.string_list_value[]
attribute_suggestions_config.attribute_filter.contains_any.value.string_value

A string, such as "department".

attribute_suggestions_config.attribute_filter.equals_to

Performs an equals operation on document attributes/fields and their values.

Show child fields
attribute_suggestions_config.attribute_filter.equals_to.key

The identifier for the attribute.

attribute_suggestions_config.attribute_filter.equals_to.value

The value of the attribute.

Show child fields
attribute_suggestions_config.attribute_filter.equals_to.value.date_value

A date expressed as an ISO 8601 string.

It is important for the time zone to be included in the ISO 8601 date-time format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.

attribute_suggestions_config.attribute_filter.equals_to.value.long_value

A long integer value.

attribute_suggestions_config.attribute_filter.equals_to.value.string_list_value[]
attribute_suggestions_config.attribute_filter.equals_to.value.string_value

A string, such as "department".

attribute_suggestions_config.attribute_filter.greater_than

Performs a greater than operation on document attributes/fields and their values. Use with the document attribute type Date or Long.

Show child fields
attribute_suggestions_config.attribute_filter.greater_than.key

The identifier for the attribute.

attribute_suggestions_config.attribute_filter.greater_than.value

The value of the attribute.

Show child fields
attribute_suggestions_config.attribute_filter.greater_than.value.date_value

A date expressed as an ISO 8601 string.

It is important for the time zone to be included in the ISO 8601 date-time format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.

attribute_suggestions_config.attribute_filter.greater_than.value.long_value

A long integer value.

attribute_suggestions_config.attribute_filter.greater_than.value.string_list_value[]
attribute_suggestions_config.attribute_filter.greater_than.value.string_value

A string, such as "department".

attribute_suggestions_config.attribute_filter.greater_than_or_equals

Performs a greater or equals than operation on document attributes/fields and their values. Use with the document attribute type Date or Long.

Show child fields
attribute_suggestions_config.attribute_filter.greater_than_or_equals.key

The identifier for the attribute.

attribute_suggestions_config.attribute_filter.greater_than_or_equals.value

The value of the attribute.

Show child fields
attribute_suggestions_config.attribute_filter.greater_than_or_equals.value.date_value

A date expressed as an ISO 8601 string.

It is important for the time zone to be included in the ISO 8601 date-time format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.

attribute_suggestions_config.attribute_filter.greater_than_or_equals.value.long_value

A long integer value.

attribute_suggestions_config.attribute_filter.greater_than_or_equals.value.string_list_value[]
attribute_suggestions_config.attribute_filter.greater_than_or_equals.value.string_value

A string, such as "department".

attribute_suggestions_config.attribute_filter.less_than

Performs a less than operation on document attributes/fields and their values. Use with the document attribute type Date or Long.

Show child fields
attribute_suggestions_config.attribute_filter.less_than.key

The identifier for the attribute.

attribute_suggestions_config.attribute_filter.less_than.value

The value of the attribute.

Show child fields
attribute_suggestions_config.attribute_filter.less_than.value.date_value

A date expressed as an ISO 8601 string.

It is important for the time zone to be included in the ISO 8601 date-time format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.

attribute_suggestions_config.attribute_filter.less_than.value.long_value

A long integer value.

attribute_suggestions_config.attribute_filter.less_than.value.string_list_value[]
attribute_suggestions_config.attribute_filter.less_than.value.string_value

A string, such as "department".

attribute_suggestions_config.attribute_filter.less_than_or_equals

Performs a less than or equals operation on document attributes/fields and their values. Use with the document attribute type Date or Long.

Show child fields
attribute_suggestions_config.attribute_filter.less_than_or_equals.key

The identifier for the attribute.

attribute_suggestions_config.attribute_filter.less_than_or_equals.value

The value of the attribute.

Show child fields
attribute_suggestions_config.attribute_filter.less_than_or_equals.value.date_value

A date expressed as an ISO 8601 string.

It is important for the time zone to be included in the ISO 8601 date-time format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.

attribute_suggestions_config.attribute_filter.less_than_or_equals.value.long_value

A long integer value.

attribute_suggestions_config.attribute_filter.less_than_or_equals.value.string_list_value[]
attribute_suggestions_config.attribute_filter.less_than_or_equals.value.string_value

A string, such as "department".

attribute_suggestions_config.suggestion_attributes[]
attribute_suggestions_config.user_context

Applies user context filtering so that only users who are given access to certain documents see these document in their search results.

Show child fields
attribute_suggestions_config.user_context.data_source_groups[]
Show child fields
attribute_suggestions_config.user_context.data_source_groups[].data_source_id

The identifier of the data source group you want to add to your list of data source groups. This is for filtering search results based on the groups' access to documents in that data source.

attribute_suggestions_config.user_context.data_source_groups[].group_id

The identifier of the group you want to add to your list of groups. This is for filtering search results based on the groups' access to documents.

attribute_suggestions_config.user_context.groups[]
attribute_suggestions_config.user_context.token

The user context token for filtering search results for a user. It must be a JWT or a JSON token.

attribute_suggestions_config.user_context.user_id

The identifier of the user you want to filter search results based on their access to documents.

max_suggestions_count Input Column

The maximum number of query suggestions you want to show to your users.

BIGINT
suggestion_types Input Column

The suggestions type to base query suggestions on. The suggestion types are query history or document fields/attributes. You can set one type or the other.

If you set query history as your suggestions type, Amazon Kendra suggests queries relevant to your users based on popular queries in the query history.

If you set document fields/attributes as your suggestions type, Amazon Kendra suggests queries relevant to your users based on the contents of document fields.

VARCHAR[]
Show child fields
suggestion_types[]
_aws_profile Input Column

The AWS profile defines the AWS identity used. It can be defined via credentials or by assuming a IAM role.

STRUCT(
"type" VARCHAR,
"name" VARCHAR,
"account_id" VARCHAR,
"via_profile_name" VARCHAR,
"assumed_role_arn" VARCHAR,
"organization" STRUCT(
"account_name" VARCHAR,
"id" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[],
"master_account" STRUCT(
"id" VARCHAR,
"email" VARCHAR
),
"parents" STRUCT(
"type" VARCHAR,
"id" VARCHAR,
"name" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[]
)[]
)
)
Show child fields
_aws_profile.account_id

The AWS account id

_aws_profile.assumed_role_arn

The ARN of the assumed role

_aws_profile.name

The unique name of the profile.

_aws_profile.organization

Information about this profile's membership in the AWS organization.

Show child fields
_aws_profile.organization.account_name

The name of account speciifed by the organization

_aws_profile.organization.id

The organization id

_aws_profile.organization.master_account
Show child fields
_aws_profile.organization.master_account.email

The organization master account email address

_aws_profile.organization.master_account.id

The organization master account id

_aws_profile.organization.parents[]
Show child fields
_aws_profile.organization.parents[].id

The id of the parent

_aws_profile.organization.parents[].name

The name of the parent

_aws_profile.organization.parents[].tags[]
Show child fields
_aws_profile.organization.parents[].tags[].key
_aws_profile.organization.parents[].tags[].value
_aws_profile.organization.parents[].type

The type of parent can be an organization unit or a root

_aws_profile.organization.tags[]
Show child fields
_aws_profile.organization.tags[].key
_aws_profile.organization.tags[].value
_aws_profile.type

The type of profile, either 'credentials' or 'assumed_role'

_aws_profile.via_profile_name

This IAM role for this profile is assumed by first utilizing another profile with this name to obtain credentials.

_aws_region Input Column

The AWS region to use.

VARCHAR
query_suggestions_id

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

VARCHAR
suggestions

A list of query suggestions for an index.

STRUCT(
"id" VARCHAR,
"value" STRUCT(
"text" STRUCT(
"text" VARCHAR,
"highlights" STRUCT(
"begin_offset" BIGINT,
"end_offset" BIGINT
)[]
)
),
"source_documents" STRUCT(
"document_id" VARCHAR,
"suggestion_attributes" VARCHAR[],
"additional_attributes" STRUCT(
"key" VARCHAR,
"value" STRUCT(
"string_value" VARCHAR,
"string_list_value" VARCHAR[],
"long_value" BIGINT,
"date_value" TIMESTAMP_S
)
)[]
)[]
)[]
Show child fields
suggestions[]
Show child fields
suggestions[].id

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

suggestions[].source_documents[]
Show child fields
suggestions[].source_documents[].additional_attributes[]
Show child fields
suggestions[].source_documents[].additional_attributes[].key

The identifier for the attribute.

suggestions[].source_documents[].additional_attributes[].value

The value of the attribute.

Show child fields
suggestions[].source_documents[].additional_attributes[].value.date_value

A date expressed as an ISO 8601 string.

It is important for the time zone to be included in the ISO 8601 date-time format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.

suggestions[].source_documents[].additional_attributes[].value.long_value

A long integer value.

suggestions[].source_documents[].additional_attributes[].value.string_list_value[]
suggestions[].source_documents[].additional_attributes[].value.string_value

A string, such as "department".

suggestions[].source_documents[].document_id

The identifier of the document used for a query suggestion.

suggestions[].source_documents[].suggestion_attributes[]
suggestions[].value

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

The value is the text string of a suggestion.

Show child fields
suggestions[].value.text

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

Show child fields
suggestions[].value.text.highlights[]
Show child fields
suggestions[].value.text.highlights[].begin_offset

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

suggestions[].value.text.highlights[].end_offset

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

suggestions[].value.text.text

The query suggestion text to display to the user.