createQuerySuggestionsBlockList method
Creates a block list to exlcude certain queries from suggestions.
Any query that contains words or phrases specified in the block list is blocked or filtered out from being shown as a suggestion.
You need to provide the file location of your block list text file in your S3 bucket. In your text file, enter each block word or phrase on a separate line.
For information on the current quota limits for block lists, see Quotas for Amazon Kendra.
CreateQuerySuggestionsBlockList is currently not supported in
the Amazon Web Services GovCloud (US-West) region.
For an example of creating a block list for query suggestions using the Python SDK, see Query suggestions block list.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter indexId :
The identifier of the index you want to create a query suggestions block
list for.
Parameter name :
A name for the block list.
For example, the name 'offensive-words', which includes all offensive words that could appear in user queries and need to be blocked from suggestions.
Parameter roleArn :
The Amazon Resource Name (ARN) of an IAM role with permission to access
your S3 bucket that contains the block list text file. For more
information, see IAM
access roles for Amazon Kendra.
Parameter sourceS3Path :
The S3 path to your block list text file in your S3 bucket.
Each block word or phrase should be on a separate line in a text file.
For information on the current quota limits for block lists, see Quotas for Amazon Kendra.
Parameter clientToken :
A token that you provide to identify the request to create a query
suggestions block list.
Parameter description :
A description for the block list.
For example, the description "List of all offensive words that can appear in user queries and need to be blocked from suggestions."
Parameter tags :
A list of key-value pairs that identify or categorize the block list. Tag
keys and values can consist of Unicode letters, digits, white space, and
any of the following symbols: _ . : / = + - @.
Implementation
Future<CreateQuerySuggestionsBlockListResponse>
createQuerySuggestionsBlockList({
required String indexId,
required String name,
required String roleArn,
required S3Path sourceS3Path,
String? clientToken,
String? description,
List<Tag>? tags,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSKendraFrontendService.CreateQuerySuggestionsBlockList'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'IndexId': indexId,
'Name': name,
'RoleArn': roleArn,
'SourceS3Path': sourceS3Path,
'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
if (description != null) 'Description': description,
if (tags != null) 'Tags': tags,
},
);
return CreateQuerySuggestionsBlockListResponse.fromJson(jsonResponse.body);
}