Module Smaws_Client_Kendra.Query

val request : Smaws_Lib.Context.t -> query_request -> (query_result, [> Smaws_Lib.Protocols.AwsJson.error | `AccessDeniedException of access_denied_exception | `ConflictException of conflict_exception | `InternalServerException of internal_server_exception | `ResourceNotFoundException of resource_not_found_exception | `ServiceQuotaExceededException of service_quota_exceeded_exception | `ThrottlingException of throttling_exception | `ValidationException of validation_exception ]) Stdlib.result

Searches an index given an input query.

If you are working with large language models (LLMs) or implementing retrieval augmented generation (RAG) systems, you can use Amazon Kendra's Retrieve API, which can return longer semantically relevant passages. We recommend using the Retrieve API instead of filing a service limit increase to increase the Query API document excerpt length.

You can configure boosting or relevance tuning at the query level to override boosting at the index level, filter based on document fields/attributes and faceted search, and filter based on the user or their group access to documents. You can also include certain fields in the response that might provide useful additional information.

A query response contains three types of results.

  • Relevant suggested answers. The answers can be either a text excerpt or table excerpt. The answer can be highlighted in the excerpt.
  • Matching FAQs or questions-answer from your FAQ file.
  • Relevant documents. This result type includes an excerpt of the document with the document title. The searched terms can be highlighted in the excerpt.

You can specify that the query return only one type of result using the QueryResultTypeFilter parameter. Each query returns the 100 most relevant results. If you filter result type to only question-answers, a maximum of four results are returned. If you filter result type to only answers, a maximum of three results are returned.