KendraRanking / Client / rescore

rescore#

KendraRanking.Client.rescore(**kwargs)#

Rescores or re-ranks search results from a search service such as OpenSearch (self managed). You use the semantic search capabilities of Amazon Kendra Intelligent Ranking to improve the search service’s results.

See also: AWS API Documentation

Request Syntax

response = client.rescore(
    RescoreExecutionPlanId='string',
    SearchQuery='string',
    Documents=[
        {
            'Id': 'string',
            'GroupId': 'string',
            'Title': 'string',
            'Body': 'string',
            'TokenizedTitle': [
                'string',
            ],
            'TokenizedBody': [
                'string',
            ],
            'OriginalScore': ...
        },
    ]
)
Parameters:
  • RescoreExecutionPlanId (string) –

    [REQUIRED]

    The identifier of the rescore execution plan. A rescore execution plan is an Amazon Kendra Intelligent Ranking resource used for provisioning the Rescore API.

  • SearchQuery (string) –

    [REQUIRED]

    The input query from the search service.

  • Documents (list) –

    [REQUIRED]

    The list of documents for Amazon Kendra Intelligent Ranking to rescore or rank on.

    • (dict) –

      Information about a document from a search service such as OpenSearch (self managed). Amazon Kendra Intelligent Ranking uses this information to rank and score on.

      • Id (string) – [REQUIRED]

        The identifier of the document from the search service.

      • GroupId (string) –

        The optional group identifier of the document from the search service. Documents with the same group identifier are grouped together and processed as one document within the service.

      • Title (string) –

        The title of the search service’s document.

      • Body (string) –

        The body text of the search service’s document.

      • TokenizedTitle (list) –

        The title of the search service’s document represented as a list of tokens or words. You must choose to provide Title or TokenizedTitle. You cannot provide both.

        • (string) –

      • TokenizedBody (list) –

        The body text of the search service’s document represented as a list of tokens or words. You must choose to provide Body or TokenizedBody. You cannot provide both.

        • (string) –

      • OriginalScore (float) – [REQUIRED]

        The original document score or rank from the search service. Amazon Kendra Intelligent Ranking gives the document a new score or rank based on its intelligent search algorithms.

Return type:

dict

Returns:

Response Syntax

{
    'RescoreId': 'string',
    'ResultItems': [
        {
            'DocumentId': 'string',
            'Score': ...
        },
    ]
}

Response Structure

  • (dict) –

    • RescoreId (string) –

      The identifier associated with the scores that Amazon Kendra Intelligent Ranking gives to the results. Amazon Kendra Intelligent Ranking rescores or re-ranks the results for the search service.

    • ResultItems (list) –

      A list of result items for documents with new relevancy scores. The results are in descending order.

      • (dict) –

        A result item for a document with a new relevancy score.

        • DocumentId (string) –

          The identifier of the document from the search service.

        • Score (float) –

          The relevancy score or rank that Amazon Kendra Intelligent Ranking gives to the result.

Exceptions