Skip to content

/AWS1/CL_KNDUSERCONTEXT

Provides information about the user context for an Amazon Kendra index.

User context filtering is a kind of personalized search with the benefit of controlling access to documents. For example, not all teams that search the company portal for information should access top-secret company documents, nor are these documents relevant to all users. Only specific users or groups of teams given access to top-secret documents should see these documents in their search results.

You provide one of the following:

  • User token

  • User ID, the groups the user belongs to, and any data sources the groups can access.

If you provide both, an exception is thrown.

If you're using an Amazon Kendra Gen AI Enterprise Edition index, you can use UserId, Groups, and DataSourceGroups to filter content. If you set the UserId to a particular user ID, it also includes all public documents.

Amazon Kendra Gen AI Enterprise Edition indices don't support token based document filtering. If you're using an Amazon Kendra Gen AI Enterprise Edition index, Amazon Kendra returns a ValidationException error if the Token field has a non-null value.

CONSTRUCTOR

IMPORTING

Optional arguments:

iv_token TYPE /AWS1/KNDTOKEN /AWS1/KNDTOKEN

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

iv_userid TYPE /AWS1/KNDPRINCIPALNAME /AWS1/KNDPRINCIPALNAME

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

it_groups TYPE /AWS1/CL_KNDGROUPS_W=>TT_GROUPS TT_GROUPS

The list of groups you want to filter search results based on the groups' access to documents.

it_datasourcegroups TYPE /AWS1/CL_KNDDATASOURCEGROUP=>TT_DATASOURCEGROUPS TT_DATASOURCEGROUPS

The list of data source groups you want to filter search results based on groups' access to documents in that data source.


Queryable Attributes

Token

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

Accessible with the following methods

Method Description
GET_TOKEN() Getter for TOKEN, with configurable default
ASK_TOKEN() Getter for TOKEN w/ exceptions if field has no value
HAS_TOKEN() Determine if TOKEN has a value

UserId

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

Accessible with the following methods

Method Description
GET_USERID() Getter for USERID, with configurable default
ASK_USERID() Getter for USERID w/ exceptions if field has no value
HAS_USERID() Determine if USERID has a value

Groups

The list of groups you want to filter search results based on the groups' access to documents.

Accessible with the following methods

Method Description
GET_GROUPS() Getter for GROUPS, with configurable default
ASK_GROUPS() Getter for GROUPS w/ exceptions if field has no value
HAS_GROUPS() Determine if GROUPS has a value

DataSourceGroups

The list of data source groups you want to filter search results based on groups' access to documents in that data source.

Accessible with the following methods

Method Description
GET_DATASOURCEGROUPS() Getter for DATASOURCEGROUPS, with configurable default
ASK_DATASOURCEGROUPS() Getter for DATASOURCEGROUPS w/ exceptions if field has no va
HAS_DATASOURCEGROUPS() Determine if DATASOURCEGROUPS has a value