Elasticsearch Introductory Series (ii) Interactive API

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.