KendraRanking

Table of Contents

Client

class KendraRanking.Client

A low-level client representing Amazon Kendra Intelligent Ranking (Kendra Ranking)

Amazon Kendra Intelligent Ranking uses Amazon Kendra semantic search capabilities to intelligently re-rank a search service's results.

import boto3

client = boto3.client('kendra-ranking')

These are the available methods:

can_paginate(operation_name)

Check if an operation can be paginated.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Returns
True if the operation can be paginated, False otherwise.
close()

Closes underlying endpoint connections.

create_rescore_execution_plan(**kwargs)

Creates a rescore execution plan. A rescore execution plan is an Amazon Kendra Intelligent Ranking resource used for provisioning the Rescore API. You set the number of capacity units that you require for Amazon Kendra Intelligent Ranking to rescore or re-rank a search service's results.

For an example of using the CreateRescoreExecutionPlan API, including using the Python and Java SDKs, see Semantically ranking a search service's results.

See also: AWS API Documentation

Request Syntax

response = client.create_rescore_execution_plan(
    Name='string',
    Description='string',
    CapacityUnits={
        'RescoreCapacityUnits': 123
    },
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ],
    ClientToken='string'
)
Parameters
  • Name (string) --

    [REQUIRED]

    A name for the rescore execution plan.

  • Description (string) -- A description for the rescore execution plan.
  • CapacityUnits (dict) --

    You can set additional capacity units to meet the needs of your rescore execution plan. You are given a single capacity unit by default. If you want to use the default capacity, you don't set additional capacity units. For more information on the default capacity and additional capacity units, see Adjusting capacity.

    • RescoreCapacityUnits (integer) -- [REQUIRED]

      The amount of extra capacity for your rescore execution plan.

      A single extra capacity unit for a rescore execution plan provides 0.01 rescore requests per second. You can add up to 1000 extra capacity units.

  • Tags (list) --

    A list of key-value pairs that identify or categorize your rescore execution plan. You can also use tags to help control access to the rescore execution plan. Tag keys and values can consist of Unicode letters, digits, white space, and any of the following symbols: _ . : / = + - @.

    • (dict) --

      A key-value pair that identifies or categorizes a rescore execution plan. A rescore execution plan is an Amazon Kendra Intelligent Ranking resource used for provisioning the Rescore API. You can also use a tag to help control access to a rescore execution plan. A tag key and value can consist of Unicode letters, digits, white space, and any of the following symbols: _ . : / = + - @.

      • Key (string) -- [REQUIRED]

        The key for the tag. Keys are not case sensitive and must be unique.

      • Value (string) -- [REQUIRED]

        The value associated with the tag. The value can be an empty string but it can't be null.

  • ClientToken (string) --

    A token that you provide to identify the request to create a rescore execution plan. Multiple calls to the CreateRescoreExecutionPlanRequest API with the same client token will create only one rescore execution plan.

    This field is autopopulated if not provided.

Return type

dict

Returns

Response Syntax

{
    'Id': 'string',
    'Arn': 'string'
}

Response Structure

  • (dict) --

    • Id (string) --

      The identifier of the rescore execution plan.

    • Arn (string) --

      The Amazon Resource Name (ARN) of the rescore execution plan.

Exceptions

  • KendraRanking.Client.exceptions.AccessDeniedException
  • KendraRanking.Client.exceptions.ConflictException
  • KendraRanking.Client.exceptions.ServiceQuotaExceededException
  • KendraRanking.Client.exceptions.ThrottlingException
  • KendraRanking.Client.exceptions.ValidationException
  • KendraRanking.Client.exceptions.InternalServerException
delete_rescore_execution_plan(**kwargs)

Deletes a rescore execution plan. A rescore execution plan is an Amazon Kendra Intelligent Ranking resource used for provisioning the Rescore API.

See also: AWS API Documentation

Request Syntax

response = client.delete_rescore_execution_plan(
    Id='string'
)
Parameters
Id (string) --

[REQUIRED]

The identifier of the rescore execution plan that you want to delete.

Returns
None

Exceptions

  • KendraRanking.Client.exceptions.AccessDeniedException
  • KendraRanking.Client.exceptions.ValidationException
  • KendraRanking.Client.exceptions.ConflictException
  • KendraRanking.Client.exceptions.ResourceNotFoundException
  • KendraRanking.Client.exceptions.ThrottlingException
  • KendraRanking.Client.exceptions.InternalServerException
describe_rescore_execution_plan(**kwargs)

Gets information about a rescore execution plan. A rescore execution plan is an Amazon Kendra Intelligent Ranking resource used for provisioning the Rescore API.

See also: AWS API Documentation

Request Syntax

response = client.describe_rescore_execution_plan(
    Id='string'
)
Parameters
Id (string) --

[REQUIRED]

The identifier of the rescore execution plan that you want to get information on.

Return type
dict
Returns
Response Syntax
{
    'Id': 'string',
    'Arn': 'string',
    'Name': 'string',
    'Description': 'string',
    'CapacityUnits': {
        'RescoreCapacityUnits': 123
    },
    'CreatedAt': datetime(2015, 1, 1),
    'UpdatedAt': datetime(2015, 1, 1),
    'Status': 'CREATING'|'UPDATING'|'ACTIVE'|'DELETING'|'FAILED',
    'ErrorMessage': 'string'
}

Response Structure

  • (dict) --
    • Id (string) --

      The identifier of the rescore execution plan.

    • Arn (string) --

      The Amazon Resource Name (ARN) of the rescore execution plan.

    • Name (string) --

      The name for the rescore execution plan.

    • Description (string) --

      The description for the rescore execution plan.

    • CapacityUnits (dict) --

      The capacity units set for the rescore execution plan. A capacity of zero indicates that the rescore execution plan is using the default capacity. For more information on the default capacity and additional capacity units, see Adjusting capacity.

      • RescoreCapacityUnits (integer) --

        The amount of extra capacity for your rescore execution plan.

        A single extra capacity unit for a rescore execution plan provides 0.01 rescore requests per second. You can add up to 1000 extra capacity units.

    • CreatedAt (datetime) --

      The Unix timestamp of when the rescore execution plan was created.

    • UpdatedAt (datetime) --

      The Unix timestamp of when the rescore execution plan was last updated.

    • Status (string) --

      The current status of the rescore execution plan. When the value is ACTIVE , the rescore execution plan is ready for use. If the Status field value is FAILED , the ErrorMessage field contains a message that explains why.

    • ErrorMessage (string) --

      When the Status field value is FAILED , the ErrorMessage field contains a message that explains why.

Exceptions

  • KendraRanking.Client.exceptions.ValidationException
  • KendraRanking.Client.exceptions.ResourceNotFoundException
  • KendraRanking.Client.exceptions.ThrottlingException
  • KendraRanking.Client.exceptions.AccessDeniedException
  • KendraRanking.Client.exceptions.InternalServerException
get_paginator(operation_name)

Create a paginator for an operation.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Raises OperationNotPageableError
Raised if the operation is not pageable. You can use the client.can_paginate method to check if an operation is pageable.
Return type
L{botocore.paginate.Paginator}
Returns
A paginator object.
get_waiter(waiter_name)

Returns an object that can wait for some condition.

Parameters
waiter_name (str) -- The name of the waiter to get. See the waiters section of the service docs for a list of available waiters.
Returns
The specified waiter object.
Return type
botocore.waiter.Waiter
list_rescore_execution_plans(**kwargs)

Lists your rescore execution plans. A rescore execution plan is an Amazon Kendra Intelligent Ranking resource used for provisioning the Rescore API.

See also: AWS API Documentation

Request Syntax

response = client.list_rescore_execution_plans(
    NextToken='string',
    MaxResults=123
)
Parameters
  • NextToken (string) -- If the response is truncated, Amazon Kendra Intelligent Ranking returns a pagination token in the response. You can use this pagination token to retrieve the next set of rescore execution plans.
  • MaxResults (integer) -- The maximum number of rescore execution plans to return.
Return type

dict

Returns

Response Syntax

{
    'SummaryItems': [
        {
            'Name': 'string',
            'Id': 'string',
            'CreatedAt': datetime(2015, 1, 1),
            'UpdatedAt': datetime(2015, 1, 1),
            'Status': 'CREATING'|'UPDATING'|'ACTIVE'|'DELETING'|'FAILED'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • SummaryItems (list) --

      An array of summary information for one or more rescore execution plans.

      • (dict) --

        Summary information for a rescore execution plan. A rescore execution plan is an Amazon Kendra Intelligent Ranking resource used for provisioning the Rescore API.

        • Name (string) --

          The name of the rescore execution plan.

        • Id (string) --

          The identifier of the rescore execution plan.

        • CreatedAt (datetime) --

          The Unix timestamp when the rescore execution plan was created.

        • UpdatedAt (datetime) --

          The Unix timestamp when the rescore execution plan was last updated.

        • Status (string) --

          The current status of the rescore execution plan. When the value is ACTIVE , the rescore execution plan is ready for use.

    • NextToken (string) --

      If the response is truncated, Amazon Kendra Intelligent Ranking returns a pagination token in the response.

Exceptions

  • KendraRanking.Client.exceptions.ValidationException
  • KendraRanking.Client.exceptions.AccessDeniedException
  • KendraRanking.Client.exceptions.ThrottlingException
  • KendraRanking.Client.exceptions.InternalServerException
list_tags_for_resource(**kwargs)

Gets a list of tags associated with a specified resource. A rescore execution plan is an example of a resource that can have tags associated with it.

See also: AWS API Documentation

Request Syntax

response = client.list_tags_for_resource(
    ResourceARN='string'
)
Parameters
ResourceARN (string) --

[REQUIRED]

The Amazon Resource Name (ARN) of the rescore execution plan to get a list of tags for.

Return type
dict
Returns
Response Syntax
{
    'Tags': [
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    If the action is successful, the service sends back an HTTP 200 response.

    • Tags (list) --

      A list of tags associated with the rescore execution plan.

      • (dict) --

        A key-value pair that identifies or categorizes a rescore execution plan. A rescore execution plan is an Amazon Kendra Intelligent Ranking resource used for provisioning the Rescore API. You can also use a tag to help control access to a rescore execution plan. A tag key and value can consist of Unicode letters, digits, white space, and any of the following symbols: _ . : / = + - @.

        • Key (string) --

          The key for the tag. Keys are not case sensitive and must be unique.

        • Value (string) --

          The value associated with the tag. The value can be an empty string but it can't be null.

Exceptions

  • KendraRanking.Client.exceptions.ValidationException
  • KendraRanking.Client.exceptions.ResourceUnavailableException
  • KendraRanking.Client.exceptions.ThrottlingException
  • KendraRanking.Client.exceptions.AccessDeniedException
  • KendraRanking.Client.exceptions.InternalServerException
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

  • KendraRanking.Client.exceptions.ValidationException
  • KendraRanking.Client.exceptions.ConflictException
  • KendraRanking.Client.exceptions.AccessDeniedException
  • KendraRanking.Client.exceptions.ResourceNotFoundException
  • KendraRanking.Client.exceptions.ThrottlingException
  • KendraRanking.Client.exceptions.InternalServerException
tag_resource(**kwargs)

Adds a specified tag to a specified rescore execution plan. A rescore execution plan is an Amazon Kendra Intelligent Ranking resource used for provisioning the Rescore API. If the tag already exists, the existing value is replaced with the new value.

See also: AWS API Documentation

Request Syntax

response = client.tag_resource(
    ResourceARN='string',
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
)
Parameters
  • ResourceARN (string) --

    [REQUIRED]

    The Amazon Resource Name (ARN) of the rescore execution plan to tag.

  • Tags (list) --

    [REQUIRED]

    A list of tag keys to add to a rescore execution plan. If a tag already exists, the existing value is replaced with the new value.

    • (dict) --

      A key-value pair that identifies or categorizes a rescore execution plan. A rescore execution plan is an Amazon Kendra Intelligent Ranking resource used for provisioning the Rescore API. You can also use a tag to help control access to a rescore execution plan. A tag key and value can consist of Unicode letters, digits, white space, and any of the following symbols: _ . : / = + - @.

      • Key (string) -- [REQUIRED]

        The key for the tag. Keys are not case sensitive and must be unique.

      • Value (string) -- [REQUIRED]

        The value associated with the tag. The value can be an empty string but it can't be null.

Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

    If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body.

Exceptions

  • KendraRanking.Client.exceptions.ValidationException
  • KendraRanking.Client.exceptions.ResourceUnavailableException
  • KendraRanking.Client.exceptions.ThrottlingException
  • KendraRanking.Client.exceptions.AccessDeniedException
  • KendraRanking.Client.exceptions.InternalServerException
untag_resource(**kwargs)

Removes a tag from a rescore execution plan. A rescore execution plan is an Amazon Kendra Intelligent Ranking resource used for provisioning the Rescore operation.

See also: AWS API Documentation

Request Syntax

response = client.untag_resource(
    ResourceARN='string',
    TagKeys=[
        'string',
    ]
)
Parameters
  • ResourceARN (string) --

    [REQUIRED]

    The Amazon Resource Name (ARN) of the rescore execution plan to remove the tag.

  • TagKeys (list) --

    [REQUIRED]

    A list of tag keys to remove from the rescore execution plan. If a tag key does not exist on the resource, it is ignored.

    • (string) --
Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

    If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body.

Exceptions

  • KendraRanking.Client.exceptions.ValidationException
  • KendraRanking.Client.exceptions.ResourceUnavailableException
  • KendraRanking.Client.exceptions.ThrottlingException
  • KendraRanking.Client.exceptions.AccessDeniedException
  • KendraRanking.Client.exceptions.InternalServerException
update_rescore_execution_plan(**kwargs)

Updates a rescore execution plan. A rescore execution plan is an Amazon Kendra Intelligent Ranking resource used for provisioning the Rescore API. You can update the number of capacity units you require for Amazon Kendra Intelligent Ranking to rescore or re-rank a search service's results.

See also: AWS API Documentation

Request Syntax

response = client.update_rescore_execution_plan(
    Id='string',
    Name='string',
    Description='string',
    CapacityUnits={
        'RescoreCapacityUnits': 123
    }
)
Parameters
  • Id (string) --

    [REQUIRED]

    The identifier of the rescore execution plan that you want to update.

  • Name (string) -- A new name for the rescore execution plan.
  • Description (string) -- A new description for the rescore execution plan.
  • CapacityUnits (dict) --

    You can set additional capacity units to meet the needs of your rescore execution plan. You are given a single capacity unit by default. If you want to use the default capacity, you don't set additional capacity units. For more information on the default capacity and additional capacity units, see Adjusting capacity.

    • RescoreCapacityUnits (integer) -- [REQUIRED]

      The amount of extra capacity for your rescore execution plan.

      A single extra capacity unit for a rescore execution plan provides 0.01 rescore requests per second. You can add up to 1000 extra capacity units.

Returns

None

Exceptions

  • KendraRanking.Client.exceptions.ValidationException
  • KendraRanking.Client.exceptions.ResourceNotFoundException
  • KendraRanking.Client.exceptions.ThrottlingException
  • KendraRanking.Client.exceptions.AccessDeniedException
  • KendraRanking.Client.exceptions.ServiceQuotaExceededException
  • KendraRanking.Client.exceptions.ConflictException
  • KendraRanking.Client.exceptions.InternalServerException

Paginators

The available paginators are: