Amazon Kendra Intelligent Ranking uses Amazon Kendra's semantic search capabilities to re-rank a search service's results. It does this by taking into account the search query's context, plus all the available information from the search service documents. Amazon Kendra Intelligent Ranking can improve simple keyword matching.
The CreateRescoreExecutionPlan
API creates an Amazon Kendra Intelligent Ranking resource used for
provisioning the Rescore API. The
Rescore
API re-ranks search results from a search service such as
OpenSearch (self managed).
When you call CreateRescoreExecutionPlan
, you set your required
capacity units for re-ranking a search service's results. If you don't need
more capacity units beyond the single unit default, don't change the default.
Provide only a name for your rescore execution plan. You can set up to 1000 extra
units. For information on what is included in a single capacity unit, see
Adjusting capacity.
Once you provision Amazon Kendra Intelligent Ranking, you are charged hourly
based on your set capacity units. See free tier and pricing information
A rescore execution plan ID is generated and returned in the response when you
call CreateRescoreExecutionPlan
. The Rescore
API uses
the rescore execution plan ID to re-rank a search service's results using the
capacity you set. You include the rescore execution plan ID in the configuration
files of your search service. For example, if you use OpenSearch (self managed),
you include the rescore execution plan ID in your docker-compose.yml or
opensearch.yml file—see Intelligently
ranking OpenSearch (self service) results.
An Amazon Resource Name (ARN) is also generated in the response when you call
CreateRescoreExecutionPlan
. You can use this ARN to create a
permissions policy in AWS Identity and Access Management (IAM) to restrict user
access to a specific ARN for a specific rescore execution plan. For an example of
an IAM policy to grant permission to use the
Rescore
API for a specific rescore execution plan, see Amazon Kendra Intelligent Ranking for self-managed OpenSearch.
The following is an example of creating a rescore execution plan with capacity units set to 1.
aws kendra-ranking create-rescore-execution-plan \ --name MyRescoreExecutionPlan \ --capacity-units '{"RescoreCapacityUnits":1}' Response: { "Id": "<
rescore execution plan ID
>", "Arn": "arn:aws:kendra-ranking:<region
>:<account-id
>:rescore-execution-plan/<rescore-execution-plan-id
>" }
The following is an example of updating a rescore execution plan to set capacity units to 2.
aws kendra-ranking update-rescore-execution-plan \ --id <
rescore execution plan ID
> \ --capacity-units '{"RescoreCapacityUnits":2}'
The following is an example of using the Rescore
API.
aws kendra-ranking rescore \ --rescore-execution-plan-id <
rescore execution plan ID
> \ --search-query "intelligent systems" \ --documents "[{\"Id\": \"DocId1\",\"Title\": \"Smart systems\", \"Body\": \"intelligent systems in everyday life\",\"OriginalScore\": 2.0}, {\"Id\": \"DocId2\",\"Title\": \"Smarter systems\", \"Body\": \"living with intelligent systems\",\"OriginalScore\": 1.0}]"