Open source Elasticsearch offers powerful RESTful API operations accessible via curl commands or Kibana console. This guide explains how to use curl commands and API operations to access and manage an Alibaba Cloud Elasticsearch cluster.
You can use curl commands for direct API calls or refer to the Kibana console documentation for further details.
If you're using a common user:
ssh <your_username>@<ecs_instance_ip>
sudo yum install curl
curl -u <user>:<password> http://<host>:<port>
<user>: Username for your Elasticsearch cluster, other than elastic.<password>: Password for the Elasticsearch cluster.<host>: Internal endpoint of the Elasticsearch cluster.<port>: Default port number (9200).curl -u your_username:your_password http://es-cn-vxxxxx****.elasticsearch.aliyuncs.com:9200
curl -u <user>:<password> -XGET 'http://es-cn-vxxxxx****.elasticsearch.aliyuncs.com:9200/_cat/health?v'
curl -u <user>:<password> -XGET 'http://es-cn-vxxxxx****.elasticsearch.aliyuncs.com:9200/_cat/indices?v'
curl -u <user>:<password> -XPUT 'http://es-cn-vxxxxx****.elasticsearch.aliyuncs.com:9200/product_info'
curl -u <user>:<password> -XPUT 'http://es-cn-vxxxxx****.elasticsearch.aliyuncs.com:9200/product_info/_doc/_mapping?include_type_name=true' -H 'Content-Type: application/json' -d '
{
"_doc": {
"properties": {
"productName": {"type": "text", "analyzer": "ik_smart"},
"annual_rate": {"type": "keyword"},
"describe": {"type": "text", "analyzer": "ik_smart"}
}
}
}'
curl -u <user>:<password> -XPOST 'http://es-cn-vxxxxx****.elasticsearch.aliyuncs.com:9200/product_info/_doc/1?pretty' -H 'Content-Type: application/json' -d '
{
"productName": "testpro",
"annual_rate": "3.22%",
"describe": "testpro"
}'
curl -u <user>:<password> -XPOST http://es-cn-vxxxxx****.elasticsearch.aliyuncs.com:9200/_bulk -H 'Content-Type: application/json' -d'
{ "index" : { "_index": "product_info", "_type" : "_doc", "_id" : "1" } }
{"productName":"testpro","annual_rate":"3.22%","describe":"testpro"}
{ "index" : { "_index": "product_info", "_type" : "_doc", "_id" : "2" } }
{"productName":"testpro1","annual_rate":"3.26%","describe":"testpro"}'
curl -u <user>:<password> -XGET 'http://es-cn-vxxxxx****.elasticsearch.aliyuncs.com:9200/product_info/_doc/1?pretty'
curl -u <user>:<password> -XDELETE 'http://es-cn-vxxxxx****.elasticsearch.aliyuncs.com:9200/product_info'
For more information about additional commands, refer to the official open source Elasticsearch documentation.
Managing your Alibaba Cloud Elasticsearch cluster with curl commands and API operations offers a flexible and efficient way to handle your data. Ready to start your journey with Elasticsearch on Alibaba Cloud?
Explore our tailored Cloud solutions and services to transform your data into a visual masterpiece. Click here to embark on Your 30-Day Free Trial
Unlocking the Power of Alibaba Cloud Elasticsearch: A Step-by-Step Guide to Accessing Your Cluster
Mastering Elasticsearch with Alibaba Cloud: A Guide to Using Java API Client (8.x)
Data Geek - July 29, 2024
Data Geek - April 24, 2024
Data Geek - July 11, 2024
Data Geek - June 5, 2024
Data Geek - February 21, 2025
Alibaba Cloud Community - April 15, 2024
Alibaba Cloud Elasticsearch
Alibaba Cloud Elasticsearch helps users easy to build AI-powered search applications seamlessly integrated with large language models, and featuring for the enterprise: robust access control, security monitoring, and automatic updates.
Learn More
AgentBay
Multimodal cloud-based operating environment and expert agent platform, supporting automation and remote control across browsers, desktops, mobile devices, and code.
Learn More
OpenAPI Explorer
OpenAPI Explorer allows you to call an API through its web interface or WebCLI, and view the entire process.
Learn More
API Gateway
API Gateway provides you with high-performance and high-availability API hosting services to deploy and release your APIs on Alibaba Cloud products.
Learn MoreMore Posts by Data Geek