ECE setName API do not support Chinese Character


(Rockybean) #1

Hi,

I'm testing ece api and try to update a deployment name by usign setName API.

https://www.elastic.co/guide/en/cloud-enterprise/1.0/set-es-cluster-name.html

But if I use Chinese words for new cluster name, this call will fail like below.

curl --request PUT --url https://x.x.x.x/api/v1/clusters/elasticsearch/9568df05c3a249b6b98e3bca425eb8db/metadata/name/%E4%B8%AD%E6%96%87%E5%90%8D%E7%A7%B0 

The new cluster name is 中文名称.

The response is as below:

    {
      "errors": [
        {
          "code": "root.method_not_allowed",
          "message": "HTTP method not allowed, supported methods: [GET]"
        }
      ]
    }

I think this should be a url path parameter decode problem and post here to let you guys know.

In addition, I know I can get this done by using set cluster metadata api but I have to get cluster metadata first which is a little redundant.


(Alex Piggott) #2

Interesting, thanks for the report

I think from 2.0 you can use this endpoint to update the name: https://www.elastic.co/guide/en/cloud-enterprise/current/update-es-cluster-metadata-settings.html (and that in fact will be our recommended method, the set-name is going to get deprecated at some point)

Alex


(Alex Piggott) #3

Oh I just noticed you addressed the set cluster metadata but you said:

but I have to get cluster metadata first which is a little redundant.

which isn't true, just

curl -XPATCH -H <headers> $url -d { "name": "<json encoding of name>" } should work?


(Rockybean) #4

Seem not work.

curl --request PATCH \
  --url https://x.x.x.x/api/v1/clusters/elasticsearch/9568df05c3a249b6b98e3bca425eb8db/metadata/raw \

  --data '{
    "name": "中文集"
}'

This got following response.

{
  "errors": [
    {
      "code": "root.method_not_allowed",
      "message": "HTTP method not allowed, supported methods: [GET]"
    }
  ]
}

(Alex Piggott) #5

That's the raw endpoint, you don't want to go anywhere near that :slight_smile:

https://x.x.x.x/api/v1/clusters/elasticsearch/9568df05c3a249b6b98e3bca425eb8db/metadata/settings

is what you want


(Rockybean) #6

Big thanks!

This works!


(system) closed #7

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.