This topic describes how to upload a custom synonym dictionary file to your Alibaba Cloud Elasticsearch cluster. After you upload a custom file and the synonym dictionary of your Elasticsearch cluster is updated, you can search new indexes by using the updated synonym dictionary.
- After you upload a synonym dictionary file to your Elasticsearch cluster, the cluster is restarted. During the restart process, the system updates the synonym dictionary file to all nodes in the cluster. The time that is required for the updated dictionary to take effect is based on the number of nodes.
- Assume that the
index-aliyunindex is created based on the aliyun.txt synonym file. If you have uploaded a new synonym dictionary file to overwrite the existing dictionary file, the existing index cannot automatically load the new dictionary file. You must recreate the indexes after you update the synonym dictionary. Otherwise, the updated synonym dictionary only takes effect on new indexes.
- A synonym dictionary file must be a
TXTfile encoded by using
UTF-8. Each line can contain only one synonym expression.
ipod, i-pod, i pod => ipod, i-pod, i pod foo => foo bar
- Log on to the Alibaba Cloud Elasticsearch console.
- In the top navigation bar, select the region where your Alibaba Cloud Elasticsearch cluster resides.
- Find the target cluster and click its ID.
- In the left-side navigation pane of the cluster details page, click Cluster Configuration.
- On the Cluster Configuration page, click Synonym Dictionary Configuration on the right side of Word Splitting.
- In the Synonym Dictionary Configuration pane, select the mode that you want to upload a synonym dictionary file. Then, upload
the file that is generated based on the rules in Configuration rules.
- Upload: If you select this mode, click Upload and select the local synonym dictionary file that you want to upload.
- Add OSS File: If you select this mode, specify Bucket Name and File Name and click Add.
Make sure that the specified bucket is in the same region as the Elasticsearch cluster and the specified file is a TXT file.
- Click Save.
What to do next
setting. For more information, see Using Synonyms in the open-source Elasticsearch documentation and Configure synonyms.