:doc:`KendraRanking <../../kendra-ranking>` / Client / rescore

*******
rescore
*******



.. py:method:: 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 <https://docs.aws.amazon.com/goto/WebAPI/kendra-ranking-2022-10-19/Rescore>`_  


  **Request Syntax**
  ::

    response = client.rescore(
        RescoreExecutionPlanId='string',
        SearchQuery='string',
        Documents=[
            {
                'Id': 'string',
                'GroupId': 'string',
                'Title': 'string',
                'Body': 'string',
                'TokenizedTitle': [
                    'string',
                ],
                'TokenizedBody': [
                    'string',
                ],
                'OriginalScore': ...
            },
        ]
    )
    
  :type RescoreExecutionPlanId: string
  :param RescoreExecutionPlanId: **[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.

    

  
  :type SearchQuery: string
  :param SearchQuery: **[REQUIRED]** 

    The input query from the search service.

    

  
  :type Documents: list
  :param Documents: **[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.

        

      
    

  
  :rtype: 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**
  
  *   :py:class:`KendraRanking.Client.exceptions.ValidationException`

  
  *   :py:class:`KendraRanking.Client.exceptions.ConflictException`

  
  *   :py:class:`KendraRanking.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`KendraRanking.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`KendraRanking.Client.exceptions.ThrottlingException`

  
  *   :py:class:`KendraRanking.Client.exceptions.InternalServerException`

  