All Products
Search
Document Center

Elasticsearch:ValidateConnection

更新時間:Jul 08, 2024

Tests the connectivity between a Logstash cluster and its associated Elasticsearch cluster when you configure the X-Pack Monitoring feature for the Logstash cluster.

Note To enable X-Pack monitoring for Logstash, you must configure a Elasticsearch instance. After the configuration, you can monitor the Logstash instance in the Kibana of the corresponding 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 headers

This 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

POST /openapi/logstashes/{InstanceId}/validate-connection HTTP/1.1

Request parameters

Parameter

Type

Position

Required

Example

Description

InstanceId String Path Yes ls-cn-oew1qbgl****

The ID of the Logstash cluster.

ClientToken String Query No. 5A2CFF0E-5718-45B5-9D4D-70B3FF****

that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length.

String Body No { "endpoints": [ "http://es-cn-n6w1o1x0w001c****.elasticsearch.aliyuncs.com:9200" ], "userName": "elastic", "password": "xxxx" }

The information about the Elasticsearch instance to be connected.

RequestBody

You must configure the following parameters in the request body to specify the information of the associated Elasticsearch cluster.

Note Logstash and Elasticsearch instances must meet the compatibility requirements. For more information, see Product compatibility.

Header

Type

Required

Example

Description

endpoints

List<String\>

Yes

["http://es-cn-n6w1o1x0w001c****.elasticsearch.aliyuncs.com:9200"]

Provides the access address of the Elasticsearch instance that is X-Pack to be monitored.

userName

String

Yes

elastic

The username that is used to access the Elasticsearch cluster.

password

String

Yes

xxx

The password that is used to access the Elasticsearch cluster.

The following sample code provides an example.

{
    "endpoints": [
        "http://es-cn-n6w1o1x0w001c****.elasticsearch.aliyuncs.com:9200"
    ],
    "userName": "elastic",
    "password": "xxxx"
}

Response parameters

Parameter

Type

Example

Description

Result Boolean true

Indicates whether the connectivity is normal. Valid values:

  • true
  • false
RequestId String 5FFD9ED4-C2EC-4E89-B22B-1ACB6FE1D***

The ID of the request.

Examples

Sample requests

POST /openapi/logstashes/ls-cn-oew1qbgl****/validate-connection HTTP/1.1
Common request headers
{
    "endpoints": [
        "http://es-cn-n6w1o1x0w001c****.elasticsearch.aliyuncs.com:9200"
    ],
    "userName": "elastic",
    "password": "xxxx"
}

Sample success responses

JSON format

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

{
  "Result" : true,
  "RequestId" : "D5B41051-FE06-4986-9D87-3779E627****"
}

Error codes

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