All Products
Search
Document Center

Elasticsearch:ListTagResources

更新時間:Aug 16, 2024

Queries the tags that are added to one or more resources.

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 headers

The CreateInstance operation does not have operation-specific request headers and uses only common request headers. For more information, refer to the documentation of common request parameters.

Request syntax

GET /openapi/tags HTTP/1.1

Request parameters

Parameter

Type

Position

Required

Example

Description

Page Integer Query No 1

The number of pages in the resource relationship list. This field is obsolete.

Size Integer Query No 10

The number of entries to be returned on each page. This field is obsolete.

ResourceType String Query Yes INSTANCE

The type of resources that you want to label.

NextToken String Query No 1d2db86sca4384811e0b5e8707e******

A pagination token. It can be used in the next request to retrieve a new page of results.

ResourceIds String Query No ["es-cn-aaa","es-cn-bbb"]

The IDs of the instances that you want to query. Use a JSON array to specify the IDs. You can specify up to 20 IDs.

Tags String Query No [{"key":"env","value":"dev"},{"key":"dev", "value":"IT"}]

The list of tags to query. It is a JSON string and contains a maximum of 20 subitems.

  • You must specify at least one of the ResourceIds and Tags parameters. Otherwise, an error is returned.
  • You can query only the visible tags in the system tags. You cannot query the invisible tags.

    Note System tags refer to the tags that are added to user instances by Alibaba Cloud services. System labels are classified into visible labels and invisible labels.

Response parameters

Parameter

Type

Example

Description

PageSize Integer 1

The number of the returned page.

RequestId String F99407AB-2FA9-489E-A259-40CF6D******

The request ID.

Headers Object

The header of the response. This parameter is empty and is for reference only. This parameter cannot be forcibly relied on in the program.

Note This parameter is not included in the returned example.
X-Total-Count Integer 10

The number of TagResource resources that are queried.

TagResources Object

A list of resources that have tags.

TagResource Array of TagResource

The list of tags.

TagValue String dev

The label value.

ResourceType String ALIYUN::ELASTICSEARCH::INSTANCE

The type of the resources. The value is fixed to ALIYUN:: Elasticsearch::INSTANCE.

ResourceId String es-cn-oew1q8bev0002****

The ID of the resource.

TagKey String env

The label key.

Examples

Sample requests

GET /openapi/tags?ResourceType=INSTANCE&NextToken=1d2db86sca4384811e0b5e8707e******&ResourceIds=["es-cn-aaa","es-cn-bbb"]&Tags=[{"key":"env", "value":"dev"},{"key":"dev", "value":"IT"}] HTTP/1.1
Host:elasticsearch.aliyuncs.com
Content-Type:application/json

Sample success responses

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "A5423B74-DBD5-4714-BF28-6725E5BE****",
  "TagResources" : {
    "TagResource" : [ {
      "ResourceType" : "ALIYUN::ELASTICSEARCH::INSTANCE",
      "ResourceId" : "es-cn-oew1q8bev0002****",
      "TagKey" : "env",
      "TagValue" : "dev"
    } ]
  }
}

Error codes

For a list of error codes, see Service error codes.