Connecting to Elasticsearch Using cURL command
This article will show you how to connect to Elasticsearch by issuing cRUL commands in SSH.
Note: For the security purpose, only the account holders who pass our verification will be granted permission to the Shell / SSH service. If you would like to enable it, please update your billing information. Our staff will finish verifying your information within 2 hours.
1. Locate your target deployment
Log in to the Control Panel and locate your target deployment on the Home page or the My Applications page.
2.Get the connection information
Go to the Overview page by clicking the "Manage" button on the Home page or the My Applications page.
3. Connect to your Elasticsearch Using cURL
Go to the Shell / SSH page and click the “Connect” icon on the Shell / SSH page to launch the command-line interface.
For security reasons, only the accounts have passed our verification will be granted permission to the Shell / SSH service. If you would like to enable it, please update your billing information. Our staff will finish verifying your information within 2 hours.
Issue the following cURL command to connect to your Elasticsearch.
curl --cacert /cloudclusters/elasticsearch/config/certificates/ca.crt -u elastic <Elasticsearch url>
Note: Please replace <Elasticsearch url>
with your Elasticsearch url you get in the Connection information section from step 2.
4. More cURL commands for managing your Elasticsearch
- Check the cluster health status
curl -u elastic <Elasticsearch url>/_cat/health
- List all nodes
curl -u elastic <Elasticsearch url>/_cat/nodes
- View all indices
curl -u elastic <Elasticsearch url>/_cat/indices
- Create an index
curl -u elastic -X PUT <Elasticsearch url>/<index_name>
- Delete an index
curl -u elastic -X DELETE "<Elasticsearch url>/<index_name>"
- Search for all data in an index
curl -u elastic <Elasticsearch url>/<index_name>/_search?pretty=true
Note: Do remember to replace<Elasticsearch url>
and <index_name>
.