Elasticsearch 使用 RESTful API 进行通信
Elasticsearch curl 大约 1215 字说明
一个Elasticsearch请求和任何HTTP请求一样由若干相同的部件组成:
curl -X<VERB> '<PROTOCOL>://<HOST>:<PORT>/<PATH>?<QUERY_STRING>' -d '<BODY>'
< > 标记的部件 | 解释 |
---|---|
VERB | 适当的 HTTP 方法 或 谓词 : GET、 POST、 PUT、 HEAD 或者 DELETE |
PROTOCOL | http或者https(如果你在Elasticsearch前面有一个 https 代理) |
HOST | Elasticsearch集群中任意节点的主机名,或者用 localhost 代表本地机器上的节点 |
PORT | 运行Elasticsearch HTTP服务的端口号,默认是9200 |
PATH | API 的终端路径(例如_count将返回集群中文档数量)。Path可能包含多个组件,例如:_cluster/stats和_nodes/stats/jvm |
QUERY_STRING | 任意可选的查询字符串参数 (例如?pretty将格式化地输出JSON返回值,使其更容易阅读) |
BODY | 一个 JSON 格式的请求体 (如果请求需要的话) |
显示头信息
-i 参数
curl -i -XGET "localhost:9200"
输出:
HTTP/1.1 200 OK
content-type: application/json; charset=UTF-8
content-length: 507
{
"name" : "XB-20160512KXIY",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "ujB-mjmDR52RMsRRpMraow",
"version" : {
"number" : "7.0.0",
"build_flavor" : "default",
"build_type" : "zip",
"build_hash" : "b7e28a7",
"build_date" : "2019-04-05T22:55:32.697037Z",
"build_snapshot" : false,
"lucene_version" : "8.0.0",
"minimum_wire_compatibility_version" : "6.7.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
阅读 1080 · 发布于 2019-04-25
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb扫描下方二维码关注公众号和小程序↓↓↓

昵称:
随便看看
换一批
-
Android 有权查看使用权限的应用阅读 4642
-
PostgreSQL 备份与还原阅读 3658
-
设计模式之组合模式阅读 1047
-
使用 Spring Boot Admin 管理 Spring Boot 应用阅读 1297
-
Android 去除 SDK 危险权限阅读 2371
-
软考大纲:系统架构设计师阅读 834
-
MySQL Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root阅读 1999
-
Kubernetes Service 对外提供访问阅读 380
-
Linux 添加 iptables 防火墙规则阅读 1621
-
Java 普通工程 maven 打包阅读 1559