Get all available regions for the Amazon CloudSearch service.
Return type: | list |
---|---|
Returns: | A list of boto.regioninfo.RegionInfo |
A Cloudsearch domain.
Variables: |
|
---|
Defines an IndexField, either replacing an existing definition or creating a new one.
Parameters: |
|
---|---|
Raises: | BaseException, InternalException, LimitExceededException, InvalidTypeException, ResourceNotFoundException |
Create a new rank expression.
Parameters: |
|
---|---|
Raises: | BaseException, InternalException, LimitExceededException, InvalidTypeException, ResourceNotFoundException |
Delete this domain and all index data associated with it.
Return a boto.cloudsearch.option.OptionStatus object representing the currently defined access policies for the domain.
Return a list of index fields defined for this domain.
Return a list of rank expressions defined for this domain.
Return a boto.cloudsearch.option.OptionStatus object representing the currently defined stemming options for the domain.
Return a boto.cloudsearch.option.OptionStatus object representing the currently defined stopword options for the domain.
Return a boto.cloudsearch.option.OptionStatus object representing the currently defined synonym options for the domain.
Tells the search domain to start indexing its documents using the latest text processing options and IndexFields. This operation must be invoked to make options whose OptionStatus has OptioState of RequiresIndexDocuments visible in search results.
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 |
Defines an IndexField, either replacing an existing definition or creating a new one.
Parameters: |
|
---|---|
Raises: | BaseException, InternalException, LimitExceededException, InvalidTypeException, ResourceNotFoundException |
Defines a RankExpression, either replacing an existing definition or creating a new one.
Parameters: |
|
---|---|
Raises: | BaseException, InternalException, LimitExceededException, InvalidTypeException, ResourceNotFoundException |
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 |
Deletes an existing IndexField from the search domain.
Parameters: |
|
---|---|
Raises: | BaseException, InternalException, ResourceNotFoundException |
Deletes an existing RankExpression from the search domain.
Parameters: |
|
---|---|
Raises: | BaseException, InternalException, ResourceNotFoundException |
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 |
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 |
Describes index fields in the search domain, optionally limited to a single IndexField.
Parameters: |
|
---|---|
Raises: | BaseException, InternalException, ResourceNotFoundException |
Describes RankExpressions in the search domain, optionally limited to a single expression.
Parameters: |
|
---|---|
Raises: | BaseException, InternalException, ResourceNotFoundException |
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 |
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 |
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 |
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 |
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 |
Updates options defining the default search field used by indexing for the search domain.
Parameters: |
|
---|---|
Raises: | BaseException, InternalException, InvalidTypeException, ResourceNotFoundException |
Updates the policies controlling access to the services in this search domain.
Parameters: |
|
---|---|
Raises: | BaseException, InternalException, LimitExceededException, ResourceNotFoundException, InvalidTypeException |
Updates stemming options used by indexing for the search domain.
Parameters: |
|
---|---|
Raises: | BaseException, InternalException, InvalidTypeException, LimitExceededException, ResourceNotFoundException |
Updates stopword options used by indexing for the search domain.
Parameters: |
|
---|---|
Raises: | BaseException, InternalException, InvalidTypeException, LimitExceededException, ResourceNotFoundException |
Updates synonym options used by indexing for the search domain.
Parameters: |
|
---|---|
Raises: | BaseException, InternalException, InvalidTypeException, LimitExceededException, ResourceNotFoundException |
Create a new CloudSearch domain and return the corresponding boto.cloudsearch.domain.Domain object.
Return a list of boto.cloudsearch.domain.Domain objects for each domain defined in the current account.
Lookup a single domain :param domain_name: The name of the domain to look up :type domain_name: str
Returns: | Domain object, or None if the domain isn’t found |
---|---|
Return type: | boto.cloudsearch.domain.Domain |
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: |
|
---|
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.
Write the current state of the local object back to the CloudSearch service.
Return the JSON representation of the options as a string.
Performs polling of CloudSearch to wait for the state of this object to change to the provided state.
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. |
---|
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. |
---|
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. |
---|
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. |
---|
Returns a new policy statement that will allow access to the service described by arn by the ip specified in ip.
Parameters: |
---|
Transform search parameters from instance properties to a dictionary
Return type: | dict |
---|---|
Returns: | search parameters |
Get a generator to iterate over all search results
Transparently handles the results paging from Cloudsearch search results so even if you have many thousands of results you can iterate over all results in a reasonably efficient manner.
Parameters: | query (boto.cloudsearch.search.Query) – A group of search criteria |
---|---|
Return type: | generator |
Returns: | All docs matching query |
Get a generator to iterate over all pages of search results
Parameters: |
|
---|---|
Return type: | generator |
Returns: | Generator containing boto.cloudsearch.search.SearchResults |
Return the total number of hits for query
Parameters: | query (boto.cloudsearch.search.Query) – a group of search criteria |
---|---|
Return type: | int |
Returns: | Total number of hits for query |
Send a query to CloudSearch
Each search query should use at least the q or bq argument to specify the search parameter. The other options are used to specify the criteria of the search.
Parameters: |
|
---|---|
Return type: | |
Returns: | Returns the results of this search |
The following examples all assume we have indexed a set of documents with fields: author, date, headline
A simple search will look for documents whose default text search fields will contain the search word exactly:
>>> search(q='Tim') # Return documents with the word Tim in them (but not Timothy)
A simple search with more keywords will return documents whose default text search fields contain the search strings together or separately.
>>> search(q='Tim apple') # Will match "tim" and "apple"
More complex searches require the boolean search operator.
Wildcard searches can be used to search for any words that start with the search string.
>>> search(bq="'Tim*'") # Return documents with words like Tim or Timothy)
Search terms can also be combined. Allowed operators are “and”, “or”, “not”, “field”, “optional”, “token”, “phrase”, or “filter”
>>> search(bq="(and 'Tim' (field author 'John Smith'))")
Facets allow you to show classification information about the search results. For example, you can retrieve the authors who have written about Tim:
>>> search(q='Tim', facet=['Author'])
With facet_constraints, facet_top_n and facet_sort more complicated constraints can be specified such as returning the top author out of John Smith and Mark Smith who have a document with the word Tim in it.
>>> search(q='Tim',
... facet=['Author'],
... facet_constraints={'author': "'John Smith','Mark Smith'"},
... facet=['author'],
... facet_top_n={'author': 1},
... facet_sort={'author': 'count'})
Call Cloudsearch to get the next page of search results
Return type: | boto.cloudsearch.search.SearchResults |
---|---|
Returns: | the following page of search results |
Wrapper for response to Cloudsearch document batch commit.
Parameters: |
|
---|---|
Raises: | |
Raises: | |
Raises: | |
Raises: |
Content sent for Cloud Search indexing was too long
This will usually happen when documents queued for indexing add up to more than the limit allowed per upload batch (5MB)
A CloudSearch document service.
The DocumentServiceConection is used to add, remove and update documents in CloudSearch. Commands are uploaded to CloudSearch in SDF (Search Document Format).
To generate an appropriate SDF, use add() to add or update documents, as well as delete() to remove documents.
Once the set of documents is ready to be index, use commit() to send the commands to CloudSearch.
If there are a lot of documents to index, it may be preferable to split the generation of SDF data and the actual uploading into CloudSearch. Retrieve the current SDF with get_sdf(). If this file is the uploaded into S3, it can be retrieved back afterwards for upload into CloudSearch using add_sdf_from_s3().
The SDF is not cleared after a commit(). If you wish to continue using the DocumentServiceConnection for another batch upload of commands, you will need to clear_sdf() first to stop the previous batch of commands from being uploaded again.
Add a document to be processed by the DocumentService
The document will not actually be added until commit() is called
Parameters: |
|
---|
Load an SDF from S3
Using this method will result in documents added through add() and delete() being ignored.
Parameters: | key_obj (boto.s3.key.Key) – An S3 key which contains an SDF |
---|
Clear the working documents from this DocumentServiceConnection
This should be used after commit() if the connection will be reused for another set of documents.
Actually send an SDF to CloudSearch for processing
If an SDF file has been explicitly loaded it will be used. Otherwise, documents added through add() and delete() will be used.
Return type: | CommitResponse |
---|---|
Returns: | A summary of documents added and deleted |
Schedule a document to be removed from the CloudSearch service
The document will not actually be scheduled for removal until commit() is called
Parameters: |
---|
Generate the working set of documents in Search Data Format (SDF)
Return type: | string |
---|---|
Returns: | JSON-formatted string of the documents in SDF |
Content sent for Cloud Search indexing was incorrectly encoded.
This usually happens when a document is marked as unicode but non-unicode characters are present.