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, new indexes are searched by using the updated synonym dictionary.
- After you upload a synonym dictionary file to your Elasticsearch cluster, the system restarts the cluster. During the restart, the system updates the synonym dictionary file to all nodes in the cluster. The time required for the updated dictionary to take effect depends on the number of nodes.
- A new dictionary file does not take effect for existing indexes because these indexes
cannot automatically load the file. For example, the
index-aliyunindex is created based on the aliyun.txt synonym file, and you modify the file and upload the modified file. The uploaded file does not take effect for the index. If you also want a new dictionary file to take effect on existing indexes, reindex the data in these indexes after the synonym dictionary of your cluster is updated.
- A synonym dictionary file must be a
TXTfile encoded in
UTF-8. Each line can contain only one synonym expression.
ipod, i-pod, i pod => ipod, i-pod, i pod foo => foo bar
- The stopword list of your Elasticsearch cluster cannot contain the keywords specified in the synonym dictionary file of the cluster. Otherwise, an error is reported in the logs of the cluster when you upload a new synonym file or make other changes.
- Log on to the Alibaba Cloud Elasticsearch console.
- In the top navigation bar, select the region where your cluster resides.
- In the left-side navigation pane, click Elasticsearch Clusters. On the page that appears, find the target cluster and click its ID in the Cluster ID/Name column.
- In the left-side navigation pane of the page that appears, click Cluster Configuration.
- In the Basic Configuration section, click Upload next to Synonym Dictionary Configuration.
- In the Synonym Dictionary Configuration pane, select the method that you want to use 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 method, click Upload and select the local synonym dictionary file that you want to upload.
- Add OSS File: If you select this method, specify Bucket Name and File Name, and click Add.
Make sure that the specified bucket resides in the same region as your Elasticsearch cluster and the file you want to upload is a TXT file.
- Click Save.
What to do next
setting. For more information, see Using Synonyms in open source Elasticsearch documentation and Configure synonyms.