Call the UpdateSynonymsDicts to update the Synonym Dictionary of the Elasticsearch instance.

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 common request parameters 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-cn-nif1q9o8r0008****

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.

RequestBody

The following parameters must be set in RequestBody:

Field

Type

Required

Example

Description

name

String

Yes

dic_0.txt

The name of the dictionary file you uploaded, must be a TXT file.

ossObject

No

The description of the object that is stored in OSS. If the sourceType parameter is set to OSS, this parameter is required.

└bucketName

String

No

search-cloud-test-cn-****

The name of the OSS bucket.

└key

String

No

oss/dic_0.txt

The OSS path where the dictionary file is stored.

sourceType

String

Yes

OSS

Synonym source type that supports: OSS (OSS open storage), ORIGIN (open source Elasticsearch), UPLOAD (files that you UPLOAD). If the storage space is OSS, make sure that the OSS bucket is public-read.

type

String

Yes

MAIN

The dictionary type. Valid values: STOP, MAIN, SYNONYMS, and ALI_WS.

Note └ indicates a child parameter.

Example:


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

Response parameters

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

The ID of the request.

Result Array of DictList

The return results.

fileSize Long 220

The size of the log file. Unit: MB.

name String deploy_0.txt

The name of the uploaded object.

sourceType String OSS

The source type of the synonym. Valid values:

  • UPLOAD: uploaded files
  • OSS: OSS open storage
  • ORIGIN: open source Elasticsearch
type String MAIN

The type of the dictionary. Dictionary types include:

  • STOP: stop word dictionary
  • MAIN: main dictionary
  • SYNONYMS: synonym dictionary
  • ALI_WS: Alibaba dictionary

Examples

Sample requests

PUT /openapi/instances/es-cn-nif1q9o8r0008****/synonymsDict HTTP/1.1
Common request parameters
[
    {
        "name":"deploy_0.txt",
        "ossObject":{
            "bucketName":"search-cloud-test-cn-****",
            "key":"user_dict/dict_0.dic"
        },
        "sourceType":"OSS",
        "type":"MAIN"
    },
    {
        "name":"SYSTEM_MAIN.txt",
        "type":"MAIN",
        "sourceType":"ORIGIN"
    },
    {
        "name":"SYSTEM_STOPWORD.txt",
        "type":"STOP",
        "sourceType":"ORIGIN"
    }
]

Sample success responses

XML format

<Result>
    <name>deploy_0.txt</name>
    <fileSize>220</fileSize>
    <sourceType>OSS</sourceType>
    <type>MAIN</type>
</Result>
<Result>
    <name>SYSTEM_MAIN.txt</name>
    <fileSize>2782602</fileSize>
    <sourceType>ORIGIN</sourceType>
    <type>MAIN</type>
</Result>
<Result>
    <name>SYSTEM_STOPWORD.txt</name>
    <fileSize>132</fileSize>
    <sourceType>ORIGIN</sourceType>
    <type>STOP</type>
</Result>
<RequestId>1F7FE662-CCD8-474F-BA9B-A7E0792E****</RequestId>

JSON format

{
    "Result": [

        {
            "name":"deploy_0.txt",
            "fileSize":220,
            "sourceType":"OSS",
            "type":"MAIN"
        },
        {
            "name":"SYSTEM_MAIN.txt",
            "fileSize":2782602,
            "sourceType":"ORIGIN",
            "type":"MAIN"
        },
        {
            "name":"SYSTEM_STOPWORD.txt",
            "fileSize":132,
            "sourceType":"ORIGIN",
            "type":"STOP"
        }
    ],
    "RequestId": "1F7FE662-CCD8-474F-BA9B-A7E0792E****"
}

Error codes

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