submitFeedback method

Future<void> submitFeedback({
  1. required String indexId,
  2. required String queryId,
  3. List<ClickFeedback>? clickFeedbackItems,
  4. List<RelevanceFeedback>? relevanceFeedbackItems,
})

Enables you to provide feedback to Amazon Kendra to improve the performance of your index.

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

May throw AccessDeniedException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ResourceUnavailableException. May throw ThrottlingException. May throw ValidationException.

Parameter indexId : The identifier of the index that was queried.

Parameter queryId : The identifier of the specific query for which you are submitting feedback. The query ID is returned in the response to the Query API.

Parameter clickFeedbackItems : Tells Amazon Kendra that a particular search result link was chosen by the user.

Parameter relevanceFeedbackItems : Provides Amazon Kendra with relevant or not relevant feedback for whether a particular item was relevant to the search.

Implementation

Future<void> submitFeedback({
  required String indexId,
  required String queryId,
  List<ClickFeedback>? clickFeedbackItems,
  List<RelevanceFeedback>? relevanceFeedbackItems,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSKendraFrontendService.SubmitFeedback'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'IndexId': indexId,
      'QueryId': queryId,
      if (clickFeedbackItems != null)
        'ClickFeedbackItems': clickFeedbackItems,
      if (relevanceFeedbackItems != null)
        'RelevanceFeedbackItems': relevanceFeedbackItems,
    },
  );
}