Call the UpdateSynonymsDicts, upload the dictionary, and set the Synonym Dictionary.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request header

This operation uses the common request header only. For more information, see Common parameters.

Request syntax

PUT /openapi/instances/[InstanceId]/synonymsDict HTTPS|HTTP

Request parameters

Parameter Type Required Example Description
InstanceId String Yes es-xx-b8ps5vthlfdf029***

The ID of the instance.

clientToken String No 5A2CFF0E-5718-45B5-9D4D-70B3FF****

A unique token generated by the client to guarantee the idempotency of the request. You can use the client to generate the value, but you must ensure that it is unique among different requests. The token can only contain ASCII characters and cannot exceed 64 characters in length.

Response parameters

Parameter Type Example Description
RequestId String 7C5622CC-B312-426F-85AA-B0271*******

The ID of the request.

Result Array

The returned results.

fileSize Long 220

The size of the file.

name String deploy_0.dic

The name of the uploaded object.

ossObject Struct

The description of OSS open storage objects.

bucketName String search-cloud-test-cn-****

The name of the OSS namespace.

etag String "5B3C1A2E053D763E1B002CC607C5A0FE1****"

Created when each Object in a Bucket is generated to identify the content of the Object.

key String synonym_txt/0.txt

The Key of the Object, that is, the ObjectKey of the open storage.

sourceType String OSS

The source type of the synonym. Valid values:

  • UPLOAD: uploads a file.
  • OSS:OSS open storage.
  • ORIGIN: open-source ES.
type String STOP

The type of the dictionary. Valid values:

  • STOP: The keyword used to STOP the operation.
  • MAIN: the MAIN dictionary.
  • SYNONYMS: the SYNONYMS.
  • ALI_WS: Alibaba Cloud dictionaries.

Examples

Sample requests

[
    {
        "name":"deploy_0.dic",
        "ossObject":{
            "bucketName":"search-cloud-test-cn-****",
            "key":"user_dict/dict_0.dic"
        },
        "sourceType":"OSS",
        "type":"MAIN"
    },
    {
        "name":"SYSTEM_MAIN.dic",
        "type":"MAIN",
        "sourceType":"ORIGIN"
    },
    {
        "name":"SYSTEM_STOPWORD.dic",
        "type":"STOP",
        "sourceType":"ORIGIN"
    }
]

Sample success responses

XML format

<0>
    <name>deploy_0.dic</name>
    <fileSize>220</fileSize>
    <sourceType>OSS</sourceType>
    <type>MAIN</type>
</0>
<1>
    <name>SYSTEM_MAIN.dic</name>
    <fileSize>2782602</fileSize>
    <sourceType>ORIGIN</sourceType>
    <type>MAIN</type>
</1>
<2>
    <name>SYSTEM_STOPWORD.dic</name>
    <fileSize>132</fileSize>
    <sourceType>ORIGIN</sourceType>
    <type>STOP</type>
</2>

JSON format

[
        {
            "name":"deploy_0.dic",
            "fileSize":220,
            "sourceType":"OSS",
            "type":"MAIN"
        },
        {
            "name":"SYSTEM_MAIN.dic",
            "fileSize":2782602,
            "sourceType":"ORIGIN",
            "type":"MAIN"
        },
        {
            "name":"SYSTEM_STOPWORD.dic",
            "fileSize":132,
            "sourceType":"ORIGIN",
            "type":"STOP"
        }
    ]

Error codes

HTTP status code Error code Error message Description
400 InstanceNotFound The instanceId provided does not exist The error message returned because the specified instance cannot be found. Please check the status of the instance.

For a list of error codes, visit the API Error Center.