Searching Your Data
This page was generated from content adapted from the AWS Developer Guide
Submitting Search Requests
Important Search endpoints don't change: A domain's document and search endpoints remain the same for the life of the domain. You should cache the endpoints rather than retrieving them before every upload or search request. Querying the Amazon CloudSearch configuration service by calling
aws cloudsearch describe-domains
orDescribeDomains
before every request is likely to result in your requests being throttled. IP addresses do change: Your domain's IP address can change over time, so it's important to cache the endpoint as shown in the console and returned by theaws cloudsearch describe-domains
command rather than the IP address. You should also re-resolve the endpoint DNS to an IP address regularly. For more information, see Setting the JVM TTL for DNS Name Lookups.Note The AWS SDKs return fields as arrays. Single-value fields are returned as arrays with one element, such as:
Important Special characters in the query string must be URL-encoded. For example, you must encode the
=
operator in a structured query as%3D
:(term+field%3Dtitle+'star')
. If you don't encode the special characters when you submit the search request, you'll get anInvalidQueryString
error.
Constructing Compound Queries
Important You must URL-encode special characters in the query string. For example, you must encode the
=
operator in a structured query as%3D
:(term+field%3Dtitle+'star'
). Amazon CloudSearch returns anInvalidQueryString
error if special characters are not URL-encoded. For a complete reference of URL-encodings, see the W3C HTML URL Encoding Reference.
Searching for Text in Amazon CloudSearch
Note When performing wildcard searches on text fields, keep in mind that Amazon CloudSearch tokenizes the text fields during indexing and performs stemming according to the analysis scheme configured for the field. Normally, Amazon CloudSearch performs the same text processing on the search query. However, when you search for a prefix with the wildcard operator (*) or
prefix
operator, no stemming is performed on the prefix. This means that a search for a prefix that ends ins
won't match the singular version of the term. This can happen for any term that ends ins
, not just plurals. For example, if you search theactor
field in the sample movie data forAnders
, there are three matching movies. If you search forAnder*
, you get those movies as well as several others. However, if you search forAnders*
there are no matches. This is because the term is stored in the index asander
,anders
does not appear in the index. For more information about how Amazon CloudSearch processes text and how it can affect searches, see Text Processing in Amazon CloudSearch.
Searching and Ranking Results by Geographic Location
Tip For these sample queries to work, you must configure your index with a
latlon
field and havelocation
data in your documents:
Searching DynamoDB Data
Note To upload data from DynamoDB, you must have permission to access both the service and the resources you want to upload. For more information, see Using IAM to Control Access to DynamoDB Resources.
Important When you use a DynamoDB table to configure a domain, the data is not automatically uploaded to the domain for indexing. You must upload the data for indexing as a separate step after you configure the domain.
Last updated