One, based on the HTTP protocol, in JSON for the data interactive format of the RESTful API
The components that make the request to Elasticsearch are the same as other normal HTTP requests:
Curl-x<verb> ' <PROTOCOL>://<HOST>:<PORT>/<PATH>?<QUERY_STRING> '-d ' <body > '
Verd http method: GET POST PUT HEAD DELETE
PROTOCOL http or HTTPS protocol
Port Elasticsearch HTTP service, default is 9200
Path API paths (for example, _count will return the number of files in the cluster) path can contain multiple components, such as _cluster/stats or _NODES/STATS/JVM
Query_string some optional query request parameters such as the? Pretty parameter will return the request to a more beautiful, readable JSON data
Body: A request body in JSON format
Eg: in order to calculate the number of documents in a cluster, you can use:
curl -XGET ‘http://localhost:9200/_count?pretty‘ -d ‘{ "query": { "match_all": {} }}
Results:
{ "count" : 0, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }}
Elasticsearch Introductory Series (ii) Interactive API