Module Smaws_Client_Kendra.Query

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.

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.

If you're using an Amazon Kendra Gen AI Enterprise Edition index, you can only use ATTRIBUTE_FILTER to filter search results by user context. If you're using an Amazon Kendra Gen AI Enterprise Edition index and you try to use USER_TOKEN to configure user context policy, Amazon Kendra returns a ValidationException error.

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