Call UpdateHotIkDicts to update the IK word segmentation plug-in of the Alibaba Cloud Elasticsearch instance, including the IK main word segmentation thesaurus and IK stopword thesaurus.
Before you call this operation, take note of the following items:
- If the dictionary file is stored in an Object Storage Service (OSS) bucket, you must make sure that the access control list (ACL) of the bucket is public read.
- If you do not set sourceType to ORIGIN for an uploaded dictionary file, the file will be deleted after you call this operation.
Debugging
Request headers
This operation uses only common request headers. For more information, see the "Common request parameters" section of the Common parameters topic.
Request syntax
PUT /openapi/instances/{InstanceId}/ik-hot-dict HTTP/1.1
Request parameters
Parameter |
Type |
Position |
Required |
Example |
Details |
InstanceId | String | Path | Yes | es-cn-oew1q8bev0002**** | The instance ID. |
clientToken | String | Query | No | 5A2CFF0E-5718-45B5-9D4D-70B3FF**** | The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. |
String | Body | No | See the example in RequestBody | RequestBody |
RequestBody
You must configure the following parameters in the request body.
Field |
Parameter |
Required |
Example |
Description |
name |
String |
Yes |
dic_0.dic |
The name of the dictionary file that you want to upload. |
ossObject |
Array |
Yes |
The information about the dictionary file. This parameter is required if you set sourceType to OSS. |
|
└bucketName |
String |
Yes |
search-cloud-test-cn-**** |
The name of the OSS bucket that stores the dictionary file. |
└key |
String |
Yes |
oss/dic_0.dic |
The path of the dictionary file in the OSS bucket. |
sourceType |
String |
Yes |
OSS |
The source type of the dictionary file. Valid values: OSS and ORIGIN. Usage notes: You must upload a local file to OSS and then use OSS to reference the local file. If you do not add ORIGIN to the uploaded dictionary, the system deletes the uploaded dictionary. |
type |
String |
Yes |
MAIN |
The type of the dictionaries that you want to update. Valid values: MAIN and STOP. |
- └ indicates a child parameter.
- You must add all API parameters to the RequestBody parameter. For example, when you add stopwords, all dictionary files in the default or installed thesaurus must be written to the RequestBody. In the following example, the
"sourceType":"ORIGIN"
is the existing dictionary file.
[
{
"name":"deploy_0.dic",
"ossObject":{
"bucketName":"search-cloud-test-cn-****",
"key":"user_dict/dict_0.dic"
},
"sourceType":"OSS",
"type":"MAIN"
},
{
"name":"deploy_2.dic",
"ossObject":{
"bucketName":"search-cloud-test-cn-****",
"key":"user_dict/dict_2.dic"
},
"sourceType":"OSS",
"type":"STOP"
},
{
"name":"SYSTEM_MAIN.dic",
"sourceType":"ORIGIN",
"type":"MAIN"
},
{
"name":"SYSTEM_STOPWORD.dic",
"sourceType":"ORIGIN",
"type":"STOP"
}
]
Response parameters
Parameter |
Type |
Example |
Details |
RequestId | String | 5FFD9ED4-C2EC-4E89-B22B-1ACB6FE1**** | The request ID. |
Result | Array of DictList | The response parameters. |
|
fileSize | Long | 6 | The size of the dictionary file. Unit: bytes. |
sourceType | String | OSS | The source type of the dictionary file. Valid values:
|
name | String | deploy_0.dic | The name of the dictionary file. |
type | String | MAIN | The dictionary type. Valid values:
|
Examples
Sample requests
PUT /openapi/instances/es-cn-oew1q8bev0002****/ik-hot-dict HTTP/1.1
Common request parameters
[
{
"name":"deploy_0.dic",
"ossObject":{
"bucketName":"search-cloud-test-cn-****",
"key":"user_dict/dict_0.dic"
},
"sourceType":"OSS",
"type":"MAIN"
},
{
"name":"deploy_2.dic",
"ossObject":{
"bucketName":"search-cloud-test-cn-****",
"key":"user_dict/dict_2.dic"
},
"sourceType":"OSS",
"type":"STOP"
},
{
"name":"SYSTEM_MAIN.dic",
"sourceType":"ORIGIN",
"type":"MAIN"
},
{
"name":"SYSTEM_STOPWORD.dic",
"sourceType":"ORIGIN",
"type":"STOP"
}
]
Sample success responses
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"Result" : [ {
"name" : "deploy_0.dic",
"ossObject" : {
"bucketName" : "search-cloud-test-cn-****",
"key" : "user_dict/dict_0.dic"
},
"sourceType" : "OSS",
"type" : "MAIN"
}, {
"name" : "deploy_2.dic",
"ossObject" : {
"bucketName" : "search-cloud-test-cn-****",
"key" : "user_dict/dict_2.dic"
},
"sourceType" : "OSS",
"type" : "STOP"
}, {
"name" : "SYSTEM_MAIN.dic",
"sourceType" : "ORIGIN",
"type" : "MAIN"
}, {
"name" : "SYSTEM_STOPWORD.dic",
"sourceType" : "ORIGIN",
"type" : "STOP"
} ],
"RequestId" : "E1F6991B-1F77-47EA-9666-593F11E3****"
}
Common error codes
For a list of error codes, see Service error codes.