Elasticsearch-->java REST Client API Overview:
Elasticsearch provides the rest web API, so developers can call Elasticsearch in their own restful web
For a detailed description of the Java Rest client API, see the official Documentation:java Rest Client API
You can call Elasticsearch directly using curl:
basic Syntax Format: RESTful API with JSON over HTTP
Use example:
For example, to calculate the number of files in a cluster, we can use this
curl-xget ' http://localhost:9200/_count?pretty '-d ' {"Query": {"Match_all": {}}} ' /span>
Elasticsearch returns an HTTP status code (for example:200 OK ') and (in addition to ' HEAD ' request) a JSON-formatted return value. The previous ' Curl request will return a JSON body like the following:
{"Count": 0, "_shards": { "Total": 5, "successful": 5, "failed": 0}}
did not see the HTTP header information in the returned results because we did not requirecurl" shows them. To see the header information, you need to combine '-I parameters to use curl command:
curl-i-xget ' Http://localhost:9200/_count?pretty '-d '
{"Query": {"Match_ All ": {}} '
ElasticSearch--------------------->elasticsearch clients--------------------->java REST Client API