Cloudsearch

boto.cloudsearch

boto.swf.connect_to_region(region_name, **kw_params)
boto.swf.regions()

Get all available regions for the Amazon Simple Workflow service.

Return type:list
Returns:A list of boto.regioninfo.RegionInfo

boto.cloudsearch.domain

boto.cloudsearch.layer1

class boto.cloudsearch.layer1.Layer1(aws_access_key_id=None, aws_secret_access_key=None, is_secure=True, host=None, port=None, proxy=None, proxy_port=None, proxy_user=None, proxy_pass=None, debug=0, https_connection_factory=None, region=None, path='/', api_version=None, security_token=None, validate_certs=True)
APIVersion = '2011-02-01'
DefaultRegionEndpoint = 'cloudsearch.us-east-1.amazonaws.com'
DefaultRegionName = 'us-east-1'
create_domain(domain_name)

Create a new search domain.

Parameters:domain_name (string) – A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed.
Raises:BaseException, InternalException, LimitExceededException
define_index_field(domain_name, field_name, field_type, default='', facet=False, result=False, searchable=False, source_attributes=None)

Defines an IndexField, either replacing an existing definition or creating a new one.

Parameters:
  • domain_name (string) – A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed.
  • field_name (string) – The name of a field in the search index.
  • field_type (string) – The type of field. Valid values are uint | literal | text
  • default (string or int) – The default value for the field. If the field is of type uint this should be an integer value. Otherwise, it’s a string.
  • facet (bool) – A boolean to indicate whether facets are enabled for this field or not. Does not apply to fields of type uint.
  • results (bool) – A boolean to indicate whether values of this field can be returned in search results or used in ranking. Does not apply to fields of type uint.
  • searchable (bool) – A boolean to indicate whether search is enabled for this field or not. Applies only to fields of type literal.
  • source_attributes (list of dicts) –

    An optional list of dicts that provide information about attributes for this index field. A maximum of 20 source attributes can be configured for each index field.

    Each item in the list is a dict with the following keys:

    • data_copy - The value is a dict with the following keys:
      • default - Optional default value if the source attribute
        is not specified in a document.
      • name - The name of the document source field to add
        to this IndexField.
    • data_function - Identifies the transformation to apply
      when copying data from a source attribute.
    • data_map - The value is a dict with the following keys:
      • cases - A dict that translates source field values
        to custom values.
      • default - An optional default value to use if the
        source attribute is not specified in a document.
      • name - the name of the document source field to add
        to this IndexField
    • data_trim_title - Trims common title words from a source
      document attribute when populating an IndexField. This can be used to create an IndexField you can use for sorting. The value is a dict with the following fields: * default - An optional default value. * language - an IETF RFC 4646 language code. * separator - The separator that follows the text to trim. * name - The name of the document source field to add.
Raises:

BaseException, InternalException, LimitExceededException, InvalidTypeException, ResourceNotFoundException

define_rank_expression(domain_name, rank_name, rank_expression)

Defines a RankExpression, either replacing an existing definition or creating a new one.

Parameters:
  • domain_name (string) – A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed.
  • rank_name (string) – The name of an expression computed for ranking while processing a search request.
  • rank_expression (string) –

    The expression to evaluate for ranking or thresholding while processing a search request. The RankExpression syntax is based on JavaScript expressions and supports:

    • Integer, floating point, hex and octal literals
    • Shortcut evaluation of logical operators such that an
      expression a || b evaluates to the value a if a is true without evaluting b at all
    • JavaScript order of precedence for operators
    • Arithmetic operators: + - * / %
    • Boolean operators (including the ternary operator)
    • Bitwise operators
    • Comparison operators
    • Common mathematic functions: abs ceil erf exp floor
      lgamma ln log2 log10 max min sqrt pow
    • Trigonometric library functions: acosh acos asinh asin
      atanh atan cosh cos sinh sin tanh tan
    • Random generation of a number between 0 and 1: rand
    • Current time in epoch: time
    • The min max functions that operate on a variable argument list

    Intermediate results are calculated as double precision floating point values. The final return value of a RankExpression is automatically converted from floating point to a 32-bit unsigned integer by rounding to the nearest integer, with a natural floor of 0 and a ceiling of max(uint32_t), 4294967295. Mathematical errors such as dividing by 0 will fail during evaluation and return a value of 0.

    The source data for a RankExpression can be the name of an IndexField of type uint, another RankExpression or the reserved name text_relevance. The text_relevance source is defined to return an integer from 0 to 1000 (inclusive) to indicate how relevant a document is to the search request, taking into account repetition of search terms in the document and proximity of search terms to each other in each matching IndexField in the document.

    For more information about using rank expressions to customize ranking, see the Amazon CloudSearch Developer Guide.

Raises:

BaseException, InternalException, LimitExceededException, InvalidTypeException, ResourceNotFoundException

delete_domain(domain_name)

Delete a search domain.

Parameters:domain_name (string) – A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed.
Raises:BaseException, InternalException
delete_index_field(domain_name, field_name)

Deletes an existing IndexField from the search domain.

Parameters:
  • domain_name (string) – A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed.
  • field_name (string) – A string that represents the name of an index field. Field names must begin with a letter and can contain the following characters: a-z (lowercase), 0-9, and _ (underscore). Uppercase letters and hyphens are not allowed. The names “body”, “docid”, and “text_relevance” are reserved and cannot be specified as field or rank expression names.
Raises:

BaseException, InternalException, ResourceNotFoundException

delete_rank_expression(domain_name, rank_name)

Deletes an existing RankExpression from the search domain.

Parameters:
  • domain_name (string) – A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed.
  • rank_name (string) – Name of the RankExpression to delete.
Raises:

BaseException, InternalException, ResourceNotFoundException

describe_default_search_field(domain_name)

Describes options defining the default search field used by indexing for the search domain.

Parameters:domain_name (string) – A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed.
Raises:BaseException, InternalException, ResourceNotFoundException
describe_domains(domain_names=None)

Describes the domains (optionally limited to one or more domains by name) owned by this account.

Parameters:domain_names (list) – Limits the response to the specified domains.
Raises:BaseException, InternalException
describe_index_fields(domain_name, field_names=None)

Describes index fields in the search domain, optionally limited to a single IndexField.

Parameters:
  • domain_name (string) – A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed.
  • field_names (list) – Limits the response to the specified fields.
Raises:

BaseException, InternalException, ResourceNotFoundException

describe_rank_expressions(domain_name, rank_names=None)

Describes RankExpressions in the search domain, optionally limited to a single expression.

Parameters:
  • domain_name (string) – A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed.
  • rank_names (list) – Limit response to the specified rank names.
Raises:

BaseException, InternalException, ResourceNotFoundException

describe_service_access_policies(domain_name)

Describes the resource-based policies controlling access to the services in this search domain.

Parameters:domain_name (string) – A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed.
Raises:BaseException, InternalException, ResourceNotFoundException
describe_stemming_options(domain_name)

Describes stemming options used by indexing for the search domain.

Parameters:domain_name (string) – A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed.
Raises:BaseException, InternalException, ResourceNotFoundException
describe_stopword_options(domain_name)

Describes stopword options used by indexing for the search domain.

Parameters:domain_name (string) – A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed.
Raises:BaseException, InternalException, ResourceNotFoundException
describe_synonym_options(domain_name)

Describes synonym options used by indexing for the search domain.

Parameters:domain_name (string) – A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed.
Raises:BaseException, InternalException, ResourceNotFoundException
get_response(doc_path, action, params, path='/', parent=None, verb='GET', list_marker=None)
index_documents(domain_name)

Tells the search domain to start scanning its documents using the latest text processing options and IndexFields. This operation must be invoked to make visible in searches any options whose <a>OptionStatus</a> has OptionState of RequiresIndexDocuments.

Parameters:domain_name (string) – A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed.
Raises:BaseException, InternalException, ResourceNotFoundException
update_default_search_field(domain_name, default_search_field)

Updates options defining the default search field used by indexing for the search domain.

Parameters:
  • domain_name (string) – A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed.
  • default_search_field (string) – The IndexField to use for search requests issued with the q parameter. The default is an empty string, which automatically searches all text fields.
Raises:

BaseException, InternalException, InvalidTypeException, ResourceNotFoundException

update_service_access_policies(domain_name, access_policies)

Updates the policies controlling access to the services in this search domain.

Parameters:
  • domain_name (string) – A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed.
  • access_policies (string) – An IAM access policy as described in The Access Policy Language in Using AWS Identity and Access Management. The maximum size of an access policy document is 100KB.
Raises:

BaseException, InternalException, LimitExceededException, ResourceNotFoundException, InvalidTypeException

update_stemming_options(domain_name, stems)

Updates stemming options used by indexing for the search domain.

Parameters:
  • domain_name (string) – A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed.
  • stems (string) – Maps terms to their stems. The JSON object has a single key called “stems” whose value is a dict mapping terms to their stems. The maximum size of a stemming document is 500KB. Example: {“stems”:{“people”: “person”, “walking”:”walk”}}
Raises:

BaseException, InternalException, InvalidTypeException, LimitExceededException, ResourceNotFoundException

update_stopword_options(domain_name, stopwords)

Updates stopword options used by indexing for the search domain.

Parameters:
  • domain_name (string) – A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed.
  • stopwords (string) – Lists stopwords in a JSON object. The object has a single key called “stopwords” whose value is an array of strings. The maximum size of a stopwords document is 10KB. Example: {“stopwords”: [“a”, “an”, “the”, “of”]}
Raises:

BaseException, InternalException, InvalidTypeException, LimitExceededException, ResourceNotFoundException

update_synonym_options(domain_name, synonyms)

Updates synonym options used by indexing for the search domain.

Parameters:
  • domain_name (string) – A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed.
  • synonyms (string) – Maps terms to their synonyms. The JSON object has a single key “synonyms” whose value is a dict mapping terms to their synonyms. Each synonym is a simple string or an array of strings. The maximum size of a stopwords document is 100KB. Example: {“synonyms”: {“cat”: [“feline”, “kitten”], “puppy”: “dog”}}
Raises:

BaseException, InternalException, InvalidTypeException, LimitExceededException, ResourceNotFoundException

boto.cloudsearch.layer1.do_bool(val)

boto.cloudsearch.layer2

boto.cloudsearch.optionstatus

class boto.cloudsearch.optionstatus.IndexFieldStatus(domain, data=None, refresh_fn=None, save_fn=None)
save()
class boto.cloudsearch.optionstatus.OptionStatus(domain, data=None, refresh_fn=None, save_fn=None)

Presents a combination of status field (defined below) which are accessed as attributes and option values which are stored in the native Python dictionary. In this class, the option values are merged from a JSON object that is stored as the Option part of the object.

Variables:
  • domain_name – The name of the domain this option is associated with.
  • create_date – A timestamp for when this option was created.
  • state

    The state of processing a change to an option. Possible values:

    • RequiresIndexDocuments: the option’s latest value will not be visible in searches until IndexDocuments has been called and indexing is complete.
    • Processing: the option’s latest value is not yet visible in all searches but is in the process of being activated.
    • Active: the option’s latest value is completely visible.
  • update_date – A timestamp for when this option was updated.
  • update_version – A unique integer that indicates when this option was last updated.
endElement(name, value, connection)
refresh(data=None)

Refresh the local state of the object. You can either pass new state data in as the parameter data or, if that parameter is omitted, the state data will be retrieved from CloudSearch.

save()

Write the current state of the local object back to the CloudSearch service.

startElement(name, attrs, connection)
to_json()

Return the JSON representation of the options as a string.

wait_for_state(state)

Performs polling of CloudSearch to wait for the state of this object to change to the provided state.

class boto.cloudsearch.optionstatus.RankExpressionStatus(domain, data=None, refresh_fn=None, save_fn=None)
class boto.cloudsearch.optionstatus.ServicePoliciesStatus(domain, data=None, refresh_fn=None, save_fn=None)
allow_doc_ip(ip)

Add the provided ip address or CIDR block to the list of allowable address for the document service.

Parameters:ip (string) – An IP address or CIDR block you wish to grant access to.
allow_search_ip(ip)

Add the provided ip address or CIDR block to the list of allowable address for the search service.

Parameters:ip (string) – An IP address or CIDR block you wish to grant access to.
disallow_doc_ip(ip)

Remove the provided ip address or CIDR block from the list of allowable address for the document service.

Parameters:ip (string) – An IP address or CIDR block you wish to grant access to.
disallow_search_ip(ip)

Remove the provided ip address or CIDR block from the list of allowable address for the search service.

Parameters:ip (string) – An IP address or CIDR block you wish to grant access to.
new_statement(arn, ip)

Returns a new policy statement that will allow access to the service described by arn by the ip specified in ip.

Parameters:
  • arn (string) – The Amazon Resource Notation identifier for the service you wish to provide access to. This would be either the search service or the document service.
  • ip (string) – An IP address or CIDR block you wish to grant access to.

boto.cloudsearch.document