| « PreviousNext » | |
![]() ![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
You can configure synonyms for terms that appear in the data you are searching. That way, if a user searches for the synonym rather than the indexed term, the results will include documents that contain the indexed term. For example, you might want to configure synonyms so that a search for "Rocky Four" or "Rocky 4" will match the movie titled "Rocky IV". To do that, you would configure 4 and four as synonyms of the indexed term IV.
If you want two terms to match the same documents, you must define them as synonyms of each other. For example:
cat, feline
feline, cat
The synonym dictionary is used during indexing to configure mappings for terms that occur in text fields. No synonym processing is done on the search request. By default, Amazon CloudSearch does not define any synonyms.
You can configure synonyms using the cs-configure-text-options command, from the Amazon CloudSearch console, or using the UpdateSynonymOptions configuration action.
You can use the cs-configure-text-options command to upload a text file that contains your synonym dictionary.
To configure synonyms
Create a text file that contains your synonym dictionary. Each line in the file should specify a term followed by a comma-separated list of its synonyms. For example:
cat, feline, kitten
dog, canine, puppy
horse, equine, colt
Run the cs-configure-text-options command with the --synonyms option to upload the synonym dictionary to your domain.
cs-configure-text-options -d mydomain --synonyms synonyms.txt
If you are done making configuration changes, run the cs-index-documents command to rebuild the domain's index.
cs-index-documents -d mydomain
You can configure a domain's synonyms from the Text Options panel in the Amazon CloudSearch console.
To configure synonyms
Go to the Amazon CloudSearch console at https://console.aws.amazon.com/cloudsearch/home.
In the Navigation panel, click the name of the domain, and then click the domain's Text Options link.
In the Text Options panel, click the Synonyms tab.
For each term and synonym list that you want to add to your synonyms dictionary, enter the term in the Add a Term field and the comma-separated list of synonyms in the Synonyms field. You can also edit the list directly or copy and paste the list into a text editor to make changes.

Click Submit to save your changes.
If you are done making configuration changes, click Run Indexing on the domain dashboard to rebuild the domain's index.
Call UpdateSynonymOptions to upload a JSON-formatted synonym dictionary to your domain. A synonym dictionary has a single JSON object with one property, synonyms. The value of the synonyms property is a collection of string: value pairs that map each term to one or more synonyms. To map a term to multiple synonyms, specify the synonyms as an array of strings:
{"synonyms": {
"term1": ["synonym1", "synonym2"],
"term2": ["synonym1"],
"term2": ["synonym1", "synonym2", "synonym3"]
}
}For example:
https://cloudsearch.us-east-1.amazonaws.com
?Action=UpdateSynonymOptions
&DomainName=movies
&Synonyms={"synonyms": {
"cat": ["feline", "kitten"],
"dog": ["canine","puppy"]}}
&Version=2011-02-01
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIAIOSFODNN7EXAMPLE/20120402/us-east-1/cloudsearch/aws4_request
&X-Amz-Date=2012-04-02T21:56:03.214Z
&X-Amz-SignedHeaders=host
&X-Amz-Signature=cf9a49e63e25b0131da11c9dccb4c648ff243c01ea4282d14d88e2c6
ec414523