This topic provides answers to some frequently asked questions about using a client to access an Elasticsearch cluster.

Is Alibaba Cloud Elasticsearch compatible with open source Elasticsearch APIs?

Alibaba Cloud Elasticsearch supports RESTful APIs provided by open source Elasticsearch and provides a dedicated management API.
  • Alibaba Cloud Elasticsearch is fully compatible with the RESTful APIs provided by open source Elasticsearch. You can use the RESTful APIs to manage data in a cluster. For example, you can add documents, remove documents, modify documents, search for data, or configure aliases. For more information, see Restful API.
  • Alibaba Cloud Elasticsearch provides a dedicated management API. You can call the API to implement operations that you can perform in the Alibaba Cloud Elasticsearch console. For example, you can create a cluster or configure an IP address whitelist for a cluster. For more information, see List of operations by function.

How do I configure the cluster.name parameter when I use Transport Client to access an Alibaba Cloud Elasticsearch cluster?

Set the cluster.name parameter to the ID of the cluster. You can obtain the ID from the Basic Information page of the cluster. For more information, see View the basic information of a cluster.

When I use Transport Client to access an Alibaba Cloud Elasticsearch cluster, the error message "NoNodeAvailableException" is displayed. What do I do?

The error message returned because Transport Client 5.5 or 5.6 is used. We recommend that you use Transport Client 5.3.3 to access an Alibaba Cloud Elasticsearch cluster. You can use Transport Client to access only Alibaba Cloud Elasticsearch V5.5 or V5.6 clusters. When you use Transport Client, set the client.transport.sniff parameter to false. For more information, see Transport Client (5.x).
Important Transport Client falls into disuse in open source Elasticsearch 7.0. We recommend that you use Java REST clients. For more information about Java REST clients, see High Level REST Client (6.3.x), High Level REST Client (6.7.x), and Low Level REST Client (5.x).

What do I do if the system reports the "Client Request Timeout" error message when I use a client to access an Elasticsearch cluster?

The following table describes the possibles causes of this issue and the related solutions.
Possible cause Solution
The memory of the Elasticsearch cluster is insufficient. As a result, read and write I/O operations are blocked. View the monitoring data of the Elasticsearch cluster to obtain the memory usage and the read and write workloads of the cluster. For information about how to view the monitoring data of an Elasticsearch cluster, see View cluster monitoring data. If the memory of the cluster is insufficient and the read and write workloads of the cluster are heavy, we recommend that you appropriately reduce the number of read and write operations to improve read and write performance.
You specify a short connection timeout period. As a result, timeout occurs before a connection between the client and the Elasticsearch cluster is established. Adjust the value of the ConnectTimeout parameter and the value of the SocketTimeout parameter on the client based on your business requirements. For example, you can change the value of the ConnectTimeout parameter to 10000 and the value of the SocketTimeout parameter to 30000.
Network issues such as network fluctuations occur. Resolve the issues based on the actual situation.

If the issue persists, submit a ticket.

Can I use a Java API to access an Alibaba Cloud Elasticsearch cluster over port 9200?

Yes, you can use a Java API to access an Elasticsearch cluster over port 9200. Alibaba Cloud Elasticsearch allows you to use all Java APIs supported by open source Elasticsearch to access Alibaba Cloud Elasticsearch clusters of all versions over port 9200. If you want to access an Alibaba Cloud Elasticsearch V5.X cluster, you can also use Transport Client 5.3.3 to access the cluster over port 9300. If you want to access an Alibaba Cloud Elasticsearch cluster of V6.0 or later, port 9300 is unavailable due to its potential security risks, and only port 9200 is available. Alibaba Cloud Elasticsearch does not allow you to access a cluster over a custom port.
Note You can use only the SDK of Transport Client 5.3.3 to access Elasticsearch V5.X clusters because of the bugs of the SDK of Transport Client 5.5.3. You must set the client.transport.sniff parameter to false in the code that is used to access an Elasticsearch V5.X cluster. For more information about Transport Client, see Transport Client (5.x).

What do I do if the system reports the "Connection reset by peer" error message when I use a client to access an Elasticsearch cluster?

Cause

Read and write operations are performed after the client is unexpectedly disconnected from the Elasticsearch cluster.

Solutions

You can perform the following checks to resolve the issue:
  • View the logs and monitoring data of the Elasticsearch cluster to check whether exceptions occur on the cluster.

    If issues such as unhealthy cluster status and node disconnection occur on the cluster, resolve the issues first. For information about how to view the monitoring data of an Elasticsearch cluster, see View cluster monitoring data.

  • Check whether the client is configured with a network interception policy.

    You can enable the system to capture packets from the user side, Elasticsearch service side, and Server Load Balancer (SLB) service side to troubleshoot network issues. If no network issues occur on the sides, you must check whether the client is configured with a network interception policy.

  • Check whether the TCP connection that is established based on HTTP keep-alive times out.
    HTTP keep-alive ensures that a single TCP connection can transfer packets between the server and client as many as possible. Each time a packet is transferred between the server and client, the duration of the TCP connection established based on HTTP keep-alive is updated. If no packets are transferred between the server and client during a specific period of time, the TCP connection times out. In this case, HTTP keep-alive releases and closes the TCP connection.
    Note TCP keep-alive is a keepalive mechanism that is used to detect the status of a TCP connection. In theory, if no exceptions occur on the server and client after a TCP connection is established, the TCP connection permanently exists unless it is closed. HTTP keep-alive ensures that a single TCP connection can transfer packets between the server and client as many as possible. If no packets are transferred between the server and client during a specific period of time, HTTP keep-alive releases and closes the TCP connection.

    If the TCP connection established based on HTTP keep-alive times out, you can increase the connection timeout period. For example, you can change the value of the ConnectTimeout parameter to 10000 and the value of the SocketTimeout parameter to 30000 on the client.

If the issue persists after you perform the preceding checks, you can check whether the code logic is correct, retry the connection, and analyze the issue based on the actual situation, or submit a ticket.

How do I install the curl tool and use a curl command to access an Elasticsearch cluster if I want to use a Windows client to connect to the cluster?

  1. Download the package for the curl tool and install the curl tool. You can obtain the package from curl documentation.
  2. Run a curl command to access the Elasticsearch cluster. For more information, see Use curl commands and API operations to manage an Alibaba Cloud Elasticsearch cluster.