全部產品
Search
文件中心

Elasticsearch:GetClusterDataInformation

更新時間:Jan 16, 2025

調用GetClusterDataInformation,擷取叢集的資料資訊。

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

要求標頭

該介面使用公用要求標頭,無特殊要求標頭。請參見公用請求參數文檔。

請求文法

POST /openapi/cluster/data-information HTTP/1.1

請求參數

請求參數為空白,但需填寫RequestBody。

RequestBody中需要填入以下參數,用來指定叢集資訊。

名稱

類型

是否必選

樣本值

描述

dataSourceType

String

elasticsearch

叢集類型,預設為elasticsearch。

endpoint

String

http://10.01.xx.xx

叢集公網網域名稱。源叢集的網路環境為公網時必填。

instanceId

String

es-cn-09k1rnu3g0002****

Elasticsearch執行個體ID。源叢集的網路環境為Elasticsearch叢集時必填。

vpcInstancePort

Integer

9200

叢集的訪問連接埠號碼。源叢集的網路環境為Elasticsearch叢集、阿里雲ECS服務自建叢集時必填。

vpcId

String

vpc-2ze59tt67m3nzkko9****

叢集所在的專用網路ID。源叢集的網路環境為Elasticsearch叢集、阿里雲ECS服務自建叢集時必填。

vpcInstanceId

String

es-09k1rnu3g0002****-worker

當前叢集的執行個體ID或Server Load Balancer(Server Load Balancer)執行個體ID。源叢集的網路環境為Elasticsearch叢集時必填。

username

String

elastic

叢集的訪問使用者名稱。

password

String

xxxxxx

叢集的訪問密碼。

index

String

product

索引名稱。

type

String

default

索引類型。

說明
  • index為空白,可校正Elasticsearch叢集是否可連通。如果可連通,返回結果中indices不為空白。
  • index不為空白,可擷取當前index下,settings和mapping的資訊。
  • type不為空白,可擷取當前type對應的routing欄位資訊。

源叢集的網路環境不同,需要填寫的參數不同:

  • 公網叢集:需要填寫的參數包括endpoint,樣本如下。
    
            {
             "dataSourceType": "elasticsearch",
             "endpoint": "http://es-cn-npk1shyiq000d****.public.elasticsearch.aliyuncs.com:9200",
             "username": "elastic",
             "password": "xxxxxx",
             "index": "default",
             "type": "default"
             }
          
  • 阿里雲ECS服務自建叢集:需要填寫的參數包括vpcInstancePort、vpcId和vpcIp,樣本如下。
    
           {
                "dataSourceType": "elasticsearch",
                "vpcId":"vpc-2ze55voww95g82gak****",
                "vpcInstancePort": "9200",
                "vpcIp": "10.12.xx.xx",
                "username" : "elastic",
                "password" : "xxxxxx",
                "index":  "product",
                "type" : "default"
           }
          
  • Elasticsearch叢集:需要填寫的參數包括vpcInstancePort、vpcId、vpcInstanceId和instanceId,樣本如下。
    
        {
            "dataSourceType" : "elasticsearch",
            "vpcId":"vpc-2ze55voww95g82gak****",
            "vpcInstancePort" : "9200",
            "vpcInstanceId" : "es-cn-09k1rnu3g0002****-worker",
            "instanceId" : "es-cn-oew1oxiro000f****",
            "username" : "elastic",
            "password" : "xxxxxx",
            "index":  "product",
            "type" : "default"
         }
    
        

返回資料

名稱 類型 樣本值 描述
RequestId String 5FFD9ED4-C2EC-4E89-B22B-1ACB6FE1****

請求ID。

Result Struct

返回結果。

connectable Boolean true

是否可連通。

metaInfo Struct

叢集的中繼資料資訊。

fields List ["id","name"]

索引Mapping對應的欄位。

indices List ["index1","index2","index3"]

叢集的索引列表。

mapping String {\"_doc\":{\"properties\":{\"user\":{\"properties\":{\"last\":{\"type\":\"text\",...}}}}}}

叢集的Mapping配置。

settings String {\n \"index\": {\n \"replication\": {\n}.....}}

叢集的Settings配置。

typeName List ["index1-type"]

指定索引的type。

樣本

請求樣本

POST /openapi/cluster/data-information HTTP/1.1
公用要求標頭
 {
     "dataSourceType": "elasticsearch",
     "endpoint": "http://es-cn-npk1shyiq000d****.public.elasticsearch.aliyuncs.com:9200",
     "username": "elastic",
     "password": "xxxxxx",
     "index": "default",
     "type": "default"
}

正常返回樣本

JSON格式

{
  "Result": {
    "connectable": true,
    "metaInfo": {
      "indices":  ["index1","index2","index3"],
      "typeName": ["index1-type"], 
      "settings": "{\n  \"index\": {\n    \"replication\": {\n}.....}}",  
      "mapping": "{\"_doc\":{\"properties\":{\"user\":{\"properties\":{\"last\":{\"type\":\"text\",...}}}}}}", 
      "fields": ["id","name","_id"]
    }
  },
  "RequestId" : "29AEFBA7-DD86-4B05-87A2-43F22C85****"
}

錯誤碼

訪問錯誤中心查看更多錯誤碼。