Cloudsearch — boto v2.31.0

### Navigation

- index
- modules |
- next |
- previous |
- boto v2.31.0 »

# Cloudsearch

## boto.cloudsearch2

`boto.cloudsearch2.` `connect_to_region`(region_name, **kw_params)

`boto.cloudsearch2.` `regions`()

  Get all available regions for the Amazon CloudSearch service.

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

## boto.cloudsearch2.domain

class `boto.cloudsearch2.domain.` `Domain`(layer1, data)

  A Cloudsearch domain.

  Variables: | name – The name of the domain. id – The internally generated unique identifier for the domain. created – A boolean which is True if the domain is created. It can take several minutes to initialize a domain when CreateDomain is called. Newly created search domains are returned with a False value for Created until domain creation is complete deleted – A boolean which is True if the search domain has been deleted. The system must clean up resources dedicated to the search domain when delete is called. Newly deleted search domains are returned from list_domains with a True value for deleted for several minutes until resource cleanup is complete. processing – True if processing is being done to activate the current domain configuration. num_searchable_docs – The number of documents that have been submittted to the domain and indexed. requires_index_document – True if index_documents needs to be called to activate the current domain configuration. search_instance_count – The number of search instances that are available to process search requests. search_instance_type – The instance type that is being used to process search requests. search_partition_count – The number of partitions across which the search index is spread.

  Constructor - Create a domain object from a layer1 and data params

  Parameters: | layer1 (`boto.cloudsearch2.layer1.Layer1` object) – A `boto.cloudsearch2.layer1.Layer1` object which is used to perform operations on the domain.

  `create_expression`(name, value)

    Create a new expression.

    Parameters: | name (string) – The name of an expression for processing during a search request. value (string) – The expression to evaluate for ranking or thresholding while processing a search request. The Expression syntax is based on JavaScript expressions and supports: Single value, sort enabled numeric fields (int, double, date) Other expressions The _score variable, which references a document’s relevance score The _time variable, which references the current epoch time Integer, floating point, hex, and octal literals Arithmetic operators: + - * / % Bitwise operators: | & ^ ~ << >> >>> Boolean operators (including the ternary operator): && || ! ?: Comparison operators: < <= == >= > Mathematical functions: abs ceil exp floor ln log2 log10 logn max min pow sqrt pow Trigonometric functions: acos acosh asin asinh atan atan2 atanh cos cosh sin sinh tanh tan The haversin distance function Expressions always return an integer value from 0 to the maximum 64-bit signed integer value (2^63 - 1). Intermediate results are calculated as double-precision floating point values and the return value is rounded to the nearest integer. If the expression is invalid or evaluates to a negative value, it returns 0. If the expression evaluates to a value greater than the maximum, it returns the maximum value. The source data for an Expression can be the name of an IndexField of type int or double, another Expression or the reserved name _score. The _score source is defined to return as a double from 0 to 10.0 (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.
    Returns: | ExpressionStatus object
    Return type: | `boto.cloudsearch2.option.ExpressionStatus` object
    Raises : | BaseException, InternalException, LimitExceededException, InvalidTypeException, ResourceNotFoundException

  `create_index_field`(field_name, field_type, default='', facet=False, returnable=False, searchable=False, sortable=False, highlight=False, source_field=None, analysis_scheme=None)

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

    Parameters: | field_name (string) – The name of a field in the search index. field_type (string) – The type of field. Valid values are int | double | literal | text | date | latlon | int-array | double-array | literal-array | text-array | date-array default (string or int) – The default value for the field. If the field is of type `int` 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 `int, int-array, text, text-array`. returnable (bool) – A boolean to indicate whether values of this field can be returned in search results or used in ranking. searchable (bool) – A boolean to indicate whether search is enabled for this field or not. sortable (bool) – A boolean to indicate whether sorting is enabled for this field or not. Does not apply to fields of array types. highlight (bool) – A boolean to indicate whether highlighting is enabled for this field or not. Does not apply to fields of type `double, int, date, latlon` source_field (list of strings or string) – For array types, this is the list of fields to treat as the source. For singular types, pass a string only. analysis_scheme (string) – The analysis scheme to use for this field. Only applies to `text | text-array` field types
    Returns: | IndexFieldStatus objects
    Return type: | `boto.cloudsearch2.option.IndexFieldStatus` object
    Raises : | BaseException, InternalException, LimitExceededException, InvalidTypeException, ResourceNotFoundException

  `created`
  `delete`()

    Delete this domain and all index data associated with it.

  `deleted`
  `doc_service_endpoint`
  `get_access_policies`()

    Return a `boto.cloudsearch2.option.ServicePoliciesStatus` object representing the currently defined access policies for the domain. :return: ServicePoliciesStatus object :rtype: `boto.cloudsearch2.option.ServicePoliciesStatus` object

  `get_analysis_schemes`()

    Return a list of Analysis Scheme objects.

  `get_availability_options`()

    Return a `boto.cloudsearch2.option.AvailabilityOptionsStatus` object representing the currently defined availability options for the domain. :return: OptionsStatus object :rtype: `boto.cloudsearch2.option.AvailabilityOptionsStatus`

    > object

  `get_document_service`()
  `get_expressions`(names=None)

    Return a list of rank expressions defined for this domain. :return: list of ExpressionStatus objects :rtype: list of `boto.cloudsearch2.option.ExpressionStatus`

    > object

  `get_index_fields`(field_names=None)

    Return a list of index fields defined for this domain. :return: list of IndexFieldStatus objects :rtype: list of `boto.cloudsearch2.option.IndexFieldStatus`

    > object

  `get_scaling_options`()

    Return a `boto.cloudsearch2.option.ScalingParametersStatus` object representing the currently defined scaling options for the domain. :return: ScalingParametersStatus object :rtype: `boto.cloudsearch2.option.ScalingParametersStatus`

    > object

  `get_search_service`()
  `id`
  `index_documents`()

    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 OptionState of RequiresIndexDocuments visible in search results.

  `name`
  `processing`
  `requires_index_documents`
  `search_instance_count`
  `search_partition_count`
  `search_service_endpoint`
  `service_arn`
  `update_from_data`(data)

`boto.cloudsearch2.domain.` `handle_bool`(value)

## boto.cloudsearch2.layer1

class `boto.cloudsearch2.layer1.` `CloudSearchConnection`(**kwargs)

  Amazon CloudSearch Configuration Service You use the Amazon CloudSearch configuration service to create, configure, and manage search domains. Configuration service requests are submitted using the AWS Query protocol. AWS Query requests are HTTP or HTTPS requests submitted via HTTP GET or POST with a query parameter named Action.

  The endpoint for configuration service requests is region- specific: cloudsearch. region .amazonaws.com. For example, cloudsearch.us-east-1.amazonaws.com. For a current list of supported regions and endpoints, see `Regions and Endpoints`_.

  `APIVersion` = '2013-01-01'
  `DefaultRegionEndpoint` = 'cloudsearch.us-east-1.amazonaws.com'
  `DefaultRegionName` = 'us-east-1'
  `ResponseError`

    alias of `JSONResponseError`

  `build_complex_param`(params, label, value)

    Serialize a structure.

    For example:

        param_type = 'structure'
        label = 'IndexField'
        value = {'IndexFieldName': 'a', 'IntOptions': {'DefaultValue': 5}}

    would result in the params dict being updated with these params:

        IndexField.IndexFieldName = a
        IndexField.IntOptions.DefaultValue = 5

    Parameters: | params (dict) – The params dict. The complex list params will be added to this dict. label (str) – String label for param key value (any) – The value to serialize

  `build_suggesters`(domain_name)

    Indexes the search suggestions.

    Parameters: | domain_name (string) – A string that represents the name of a domain. Domain names are unique across the domains owned by an account within an AWS region. Domain names start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen).

  `create_domain`(domain_name)

    Creates a new search domain. For more information, see `Creating a Search Domain`_ in the Amazon CloudSearch Developer Guide .

    Parameters: | domain_name (string) – A name for the domain you are creating. Allowed characters are a-z (lower-case letters), 0-9, and hyphen (-). Domain names must start with a letter or number and be at least 3 and no more than 28 characters long.

  `define_analysis_scheme`(domain_name, analysis_scheme)

    Configures an analysis scheme for a domain. An analysis scheme defines language-specific text processing options for a text field. For more information, see `Configuring Analysis Schemes`_ in the Amazon CloudSearch Developer Guide .

    Parameters: | domain_name (string) – A string that represents the name of a domain. Domain names are unique across the domains owned by an account within an AWS region. Domain names start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). analysis_scheme (dict) – Configuration information for an analysis scheme. Each analysis scheme has a unique name and specifies the language of the text to be processed. The following options can be configured for an analysis scheme: Synonyms, Stopwords, StemmingDictionary, and AlgorithmicStemming.

  `define_expression`(domain_name, expression)

    Configures an Expression for the search domain. Used to create new expressions and modify existing ones. If the expression exists, the new configuration replaces the old one. For more information, see `Configuring Expressions`_ in the Amazon CloudSearch Developer Guide .

    Parameters: | domain_name (string) – A string that represents the name of a domain. Domain names are unique across the domains owned by an account within an AWS region. Domain names start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). expression (dict) – A named expression that can be evaluated at search time. Can be used for sorting and filtering search results and constructing other expressions.

  `define_index_field`(domain_name, index_field)

    Configures an IndexField for the search domain. Used to create new fields and modify existing ones. You must specify the name of the domain you are configuring and an index field configuration. The index field configuration specifies a unique name, the index field type, and the options you want to configure for the field. The options you can specify depend on the IndexFieldType. If the field exists, the new configuration replaces the old one. For more information, see `Configuring Index Fields`_ in the Amazon CloudSearch Developer Guide .

    Parameters: | domain_name (string) – A string that represents the name of a domain. Domain names are unique across the domains owned by an account within an AWS region. Domain names start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). index_field (dict) – The index field and field options you want to configure.

  `define_suggester`(domain_name, suggester)

    Configures a suggester for a domain. A suggester enables you to display possible matches before users finish typing their queries. When you configure a suggester, you must specify the name of the text field you want to search for possible matches and a unique name for the suggester. For more information, see `Getting Search Suggestions`_ in the Amazon CloudSearch Developer Guide .

    Parameters: | domain_name (string) – A string that represents the name of a domain. Domain names are unique across the domains owned by an account within an AWS region. Domain names start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). suggester (dict) – Configuration information for a search suggester. Each suggester has a unique name and specifies the text field you want to use for suggestions. The following options can be configured for a suggester: FuzzyMatching, SortExpression.

  `delete_analysis_scheme`(domain_name, analysis_scheme_name)

    Deletes an analysis scheme. For more information, see `Configuring Analysis Schemes`_ in the Amazon CloudSearch Developer Guide .

    Parameters: | domain_name (string) – A string that represents the name of a domain. Domain names are unique across the domains owned by an account within an AWS region. Domain names start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). analysis_scheme_name (string) – The name of the analysis scheme you want to delete.

  `delete_domain`(domain_name)

    Permanently deletes a search domain and all of its data. Once a domain has been deleted, it cannot be recovered. For more information, see `Deleting a Search Domain`_ in the Amazon CloudSearch Developer Guide .

    Parameters: | domain_name (string) – The name of the domain you want to permanently delete.

  `delete_expression`(domain_name, expression_name)

    Removes an Expression from the search domain. For more information, see `Configuring Expressions`_ in the Amazon CloudSearch Developer Guide .

    Parameters: | domain_name (string) – A string that represents the name of a domain. Domain names are unique across the domains owned by an account within an AWS region. Domain names start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). expression_name (string) – The name of the Expression to delete.

  `delete_index_field`(domain_name, index_field_name)

    Removes an IndexField from the search domain. For more information, see `Configuring Index Fields`_ in the Amazon CloudSearch Developer Guide .

    Parameters: | domain_name (string) – A string that represents the name of a domain. Domain names are unique across the domains owned by an account within an AWS region. Domain names start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). index_field_name (string) – The name of the index field your want to remove from the domain’s indexing options.

  `delete_suggester`(domain_name, suggester_name)

    Deletes a suggester. For more information, see `Getting Search Suggestions`_ in the Amazon CloudSearch Developer Guide .

    Parameters: | domain_name (string) – A string that represents the name of a domain. Domain names are unique across the domains owned by an account within an AWS region. Domain names start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). suggester_name (string) – Specifies the name of the suggester you want to delete.

  `describe_analysis_schemes`(domain_name, analysis_scheme_names=None, deployed=None)

    Gets the analysis schemes configured for a domain. An analysis scheme defines language-specific text processing options for a text field. Can be limited to specific analysis schemes by name. By default, shows all analysis schemes and includes any pending changes to the configuration. Set the Deployed option to True to show the active configuration and exclude pending changes. For more information, see `Configuring Analysis Schemes`_ in the Amazon CloudSearch Developer Guide .

    Parameters: | domain_name (string) – The name of the domain you want to describe. analysis_scheme_names (list) – The analysis schemes you want to describe. deployed (boolean) – Whether to display the deployed configuration ( True) or include any pending changes ( False). Defaults to False.

  `describe_availability_options`(domain_name, deployed=None)

    Gets the availability options configured for a domain. By default, shows the configuration with any pending changes. Set the Deployed option to True to show the active configuration and exclude pending changes. For more information, see `Configuring Availability Options`_ in the Amazon CloudSearch Developer Guide .

    Parameters: | domain_name (string) – The name of the domain you want to describe. deployed (boolean) – Whether to display the deployed configuration ( True) or include any pending changes ( False). Defaults to False.

  `describe_domains`(domain_names=None)

    Gets information about the search domains owned by this account. Can be limited to specific domains. Shows all domains by default. For more information, see `Getting Information about a Search Domain`_ in the Amazon CloudSearch Developer Guide .

    Parameters: | domain_names (list) – The names of the domains you want to include in the response.

  `describe_expressions`(domain_name, expression_names=None, deployed=None)

    Gets the expressions configured for the search domain. Can be limited to specific expressions by name. By default, shows all expressions and includes any pending changes to the configuration. Set the Deployed option to True to show the active configuration and exclude pending changes. For more information, see `Configuring Expressions`_ in the Amazon CloudSearch Developer Guide .

    Parameters: | domain_name (string) – The name of the domain you want to describe. expression_names (list) – Limits the DescribeExpressions response to the specified expressions. If not specified, all expressions are shown. deployed (boolean) – Whether to display the deployed configuration ( True) or include any pending changes ( False). Defaults to False.

  `describe_index_fields`(domain_name, field_names=None, deployed=None)

    Gets information about the index fields configured for the search domain. Can be limited to specific fields by name. By default, shows all fields and includes any pending changes to the configuration. Set the Deployed option to True to show the active configuration and exclude pending changes. For more information, see `Getting Domain Information`_ in the Amazon CloudSearch Developer Guide .

    Parameters: | domain_name (string) – The name of the domain you want to describe. field_names (list) – A list of the index fields you want to describe. If not specified, information is returned for all configured index fields. deployed (boolean) – Whether to display the deployed configuration ( True) or include any pending changes ( False). Defaults to False.

  `describe_scaling_parameters`(domain_name)

    Gets the scaling parameters configured for a domain. A domain’s scaling parameters specify the desired search instance type and replication count. For more information, see `Configuring Scaling Options`_ in the Amazon CloudSearch Developer Guide .

    Parameters: | domain_name (string) – A string that represents the name of a domain. Domain names are unique across the domains owned by an account within an AWS region. Domain names start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen).

  `describe_service_access_policies`(domain_name, deployed=None)

    Gets information about the access policies that control access to the domain’s document and search endpoints. By default, shows the configuration with any pending changes. Set the Deployed option to True to show the active configuration and exclude pending changes. For more information, see `Configuring Access for a Search Domain`_ in the Amazon CloudSearch Developer Guide .

    Parameters: | domain_name (string) – The name of the domain you want to describe. deployed (boolean) – Whether to display the deployed configuration ( True) or include any pending changes ( False). Defaults to False.

  `describe_suggesters`(domain_name, suggester_names=None, deployed=None)

    Gets the suggesters configured for a domain. A suggester enables you to display possible matches before users finish typing their queries. Can be limited to specific suggesters by name. By default, shows all suggesters and includes any pending changes to the configuration. Set the Deployed option to True to show the active configuration and exclude pending changes. For more information, see `Getting Search Suggestions`_ in the Amazon CloudSearch Developer Guide .

    Parameters: | domain_name (string) – The name of the domain you want to describe. suggester_names (list) – The suggesters you want to describe. deployed (boolean) – Whether to display the deployed configuration ( True) or include any pending changes ( False). Defaults to False.

  `index_documents`(domain_name)

    Tells the search domain to start indexing its documents using the latest indexing options. This operation must be invoked to activate options whose OptionStatus is RequiresIndexDocuments.

    Parameters: | domain_name (string) – A string that represents the name of a domain. Domain names are unique across the domains owned by an account within an AWS region. Domain names start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen).

  `list_domain_names`()

    Lists all search domains owned by an account.

  `update_availability_options`(domain_name, multi_az)

    Configures the availability options for a domain. Enabling the Multi-AZ option expands an Amazon CloudSearch domain to an additional Availability Zone in the same Region to increase fault tolerance in the event of a service disruption. Changes to the Multi-AZ option can take about half an hour to become active. For more information, see `Configuring Availability Options`_ in the Amazon CloudSearch Developer Guide .

    Parameters: | domain_name (string) – A string that represents the name of a domain. Domain names are unique across the domains owned by an account within an AWS region. Domain names start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). multi_az (boolean) – You expand an existing search domain to a second Availability Zone by setting the Multi-AZ option to true. Similarly, you can turn off the Multi-AZ option to downgrade the domain to a single Availability Zone by setting the Multi-AZ option to False.

  `update_scaling_parameters`(domain_name, scaling_parameters)

    Configures scaling parameters for a domain. A domain’s scaling parameters specify the desired search instance type and replication count. Amazon CloudSearch will still automatically scale your domain based on the volume of data and traffic, but not below the desired instance type and replication count. If the Multi-AZ option is enabled, these values control the resources used per Availability Zone. For more information, see `Configuring Scaling Options`_ in the Amazon CloudSearch Developer Guide .

    Parameters: | domain_name (string) – A string that represents the name of a domain. Domain names are unique across the domains owned by an account within an AWS region. Domain names start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). scaling_parameters (dict) – The desired instance type and desired number of replicas of each index partition.

  `update_service_access_policies`(domain_name, access_policies)

    Configures the access rules that control access to the domain’s document and search endpoints. For more information, see ` Configuring Access for an Amazon CloudSearch Domain`_.

    Parameters: | domain_name (string) – A string that represents the name of a domain. Domain names are unique across the domains owned by an account within an AWS region. Domain names start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). access_policies (string) – The access rules you want to configure. These rules replace any existing rules.

## boto.cloudsearch2.layer2

class `boto.cloudsearch2.layer2.` `Layer2`(aws_access_key_id=None, aws_secret_access_key=None, is_secure=True, port=None, proxy=None, proxy_port=None, host=None, debug=0, session_token=None, region=None, validate_certs=True)
  `create_domain`(domain_name)

    Create a new CloudSearch domain and return the corresponding object. :return: Domain object, or None if the domain isn’t found :rtype: `boto.cloudsearch2.domain.Domain`

  `list_domains`(domain_names=None)

    Return a list of objects for each domain defined in the current account. :rtype: list of `boto.cloudsearch2.domain.Domain`

  `lookup`(domain_name)

    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.cloudsearch2.domain.Domain`

## boto.cloudsearch2.optionstatus

class `boto.cloudsearch2.optionstatus.` `AvailabilityOptionsStatus`(domain, data=None, refresh_fn=None, refresh_key=None, save_fn=None)
  `save`()

class `boto.cloudsearch2.optionstatus.` `ExpressionStatus`(domain, data=None, refresh_fn=None, refresh_key=None, save_fn=None)

class `boto.cloudsearch2.optionstatus.` `IndexFieldStatus`(domain, data=None, refresh_fn=None, refresh_key=None, save_fn=None)
  `save`()

class `boto.cloudsearch2.optionstatus.` `OptionStatus`(domain, data=None, refresh_fn=None, refresh_key=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.

  `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.

  `to_json`()

    Return the JSON representation of the options as a string.

class `boto.cloudsearch2.optionstatus.` `ScalingParametersStatus`(domain, data=None, refresh_fn=None, refresh_key=None, save_fn=None)

class `boto.cloudsearch2.optionstatus.` `ServicePoliciesStatus`(domain, data=None, refresh_fn=None, refresh_key=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.cloudsearch2.search

exception `boto.cloudsearch2.search.` `CommitMismatchError`

class `boto.cloudsearch2.search.` `Query`(q=None, parser=None, fq=None, expr=None, return_fields=None, size=10, start=0, sort=None, facet=None, highlight=None, partial=None, options=None)
  `RESULTS_PER_PAGE` = 500
  `to_params`()

    Transform search parameters from instance properties to a dictionary

    Return type: | dict
    Returns: | search parameters

  `update_size`(new_size)

class `boto.cloudsearch2.search.` `SearchConnection`(domain=None, endpoint=None)
  `build_query`(q=None, parser=None, fq=None, rank=None, return_fields=None, size=10, start=0, facet=None, highlight=None, sort=None, partial=None, options=None)
  `get_all_hits`(query)

    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.cloudsearch2.search.Query`) – A group of search criteria
    Return type: | generator
    Returns: | All docs matching query

  `get_all_paged`(query, per_page)

    Get a generator to iterate over all pages of search results

    Parameters: | query (`boto.cloudsearch2.search.Query`) – A group of search criteria per_page (int) – Number of docs in each `boto.cloudsearch2.search.SearchResults` object.
    Return type: | generator
    Returns: | Generator containing `boto.cloudsearch2.search.SearchResults`

  `get_num_hits`(query)

    Return the total number of hits for query

    Parameters: | query (`boto.cloudsearch2.search.Query`) – a group of search criteria
    Return type: | int
    Returns: | Total number of hits for query

  `search`(q=None, parser=None, fq=None, rank=None, return_fields=None, size=10, start=0, facet=None, highlight=None, sort=None, partial=None, options=None)

    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: | q (string) – A string to search the default search fields for. parser (string) – The parser to use. ‘simple’, ‘structured’, ‘lucene’, ‘dismax’ fq (string) – The filter query to use. sort (List of strings) – A list of fields or rank expressions used to order the search results. Order is handled by adding ‘desc’ or ‘asc’ after the field name. `['year desc', 'author asc']` return_fields (List of strings) – A list of fields which should be returned by the search. If this field is not specified, only IDs will be returned. `['headline']` size (int) – Number of search results to specify start (int) – Offset of the first search result to return (can be used for paging) facet (dict) – Dictionary of fields for which facets should be returned The facet value is string of JSON options `{'year': '{sort:"bucket", size:3}', 'genres': '{buckets:["Action","Adventure","Sci-Fi"]}'}` highlight (dict) – Dictionary of fields for which highlights should be returned The facet value is string of JSON options `{'genres': '{format:'text',max_phrases:2,pre_tag:'<b>',post_tag:'</b>'}'}` partial (bool) – Should partial results from a partioned service be returned if one or more index partitions are unreachable. options (str) – Options for the query parser specified in parser. Specified as a string in JSON format. `{fields: ['title^5', 'description']}`
    Return type: | `boto.cloudsearch2.search.SearchResults`
    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(q="'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(q="(and 'Tim' (field author 'John Smith'))", parser='structured')

    Facets allow you to show classification information about the search results. For example, you can retrieve the authors who have written about Tim with a max of 3

        >>> search(q='Tim', facet={'Author': '{sort:"bucket", size:3}'})

class `boto.cloudsearch2.search.` `SearchResults`(**attrs)
  `next_page`()

    Call Cloudsearch to get the next page of search results

    Return type: | `boto.cloudsearch2.search.SearchResults`
    Returns: | the following page of search results

exception `boto.cloudsearch2.search.` `SearchServiceException`

## boto.cloudsearch2.document

exception `boto.cloudsearch2.document.` `CommitMismatchError`

class `boto.cloudsearch2.document.` `CommitResponse`(response, doc_service, sdf)

  Wrapper for response to Cloudsearch document batch commit.

  Parameters: | response (`requests.models.Response`) – Response from Cloudsearch /documents/batch API doc_service (`boto.cloudsearch2.document.DocumentServiceConnection`) – Object containing the documents posted and methods to retry
  Raises : | `boto.exception.BotoServerError`
  Raises : | `boto.cloudsearch2.document.SearchServiceException`
  Raises : | `boto.cloudsearch2.document.EncodingError`
  Raises : | `boto.cloudsearch2.document.ContentTooLongError`

exception `boto.cloudsearch2.document.` `ContentTooLongError`

  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)

class `boto.cloudsearch2.document.` `DocumentServiceConnection`(domain=None, endpoint=None)

  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`(_id, fields)

    Add a document to be processed by the DocumentService

    The document will not actually be added until `commit()` is called

    Parameters: | _id (string) – A unique ID used to refer to this document. fields (dict) – A dictionary of key-value pairs to be uploaded .

  `add_sdf_from_s3`(key_obj)

    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_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.

  `commit`()

    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

  `delete`(_id)

    Schedule a document to be removed from the CloudSearch service

    The document will not actually be scheduled for removal until `commit()` is called

    Parameters: | _id (string) – The unique ID of this document.

  `get_sdf`()

    Generate the working set of documents in Search Data Format (SDF)

    Return type: | string
    Returns: | JSON-formatted string of the documents in SDF

exception `boto.cloudsearch2.document.` `EncodingError`

  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.

exception `boto.cloudsearch2.document.` `SearchServiceException`

### Navigation

- index
- modules |
- next |
- previous |
- boto v2.31.0 »