1:curl
curl -h来查看请求参数的含义
-v 显示请求的信息
-X 选项指定其它协议
get:
curl -v 127.0.0.1:8080/users/age/18
post:
curl -v 127.0.0.1:8080/users -d 'age=14&cupSize=C'
curl -v -X POST 127.0.0.1:8080/users -d 'age=14&cupSize=C'
put:
curl -v -X PUT -d "age=19&cupSize=C" 127.0.0.1:8080/users/3
delete:
curl -v -X DELETE 127.0.0.1:8080/users/3
2:elasticsearch
检查运行
root@micro-node3:/opt/application# curl http://localhost:9200/
{
"name" : "micro-node3",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "B6DsBJbGSp6UMc-uxKC1zg",
"version" : {
"number" : "7.3.0",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "de777fa",
"build_date" : "2019-07-24T18:30:11.767338Z",
"build_snapshot" : false,
"lucene_version" : "8.1.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You KNow, for Search"
}
集群健康
root@micro-node3:/opt/application# curl -X GET localhost:9200/_cat/health?v
epoch timestamp cluster status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
1634371100 07:58:20 elasticsearch yellow 1 1 1 1 0 0 1 0 - 50.0%
请求集群健康时,会得到green, yellow, 或者 red 这三种状态。
节点列表
root@micro-node3:/opt/application# curl -X GET "localhost:9200/_cat/nodes?v"
ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
127.0.0.1 25 59 0 0.00 0.00 0.00 dim * micro-node3
查看全部索引
curl 127.0.0.1:9200/_cat/indices?v
创建一个索引
curl -X PUT "localhost:9200/js_goods?pretty"
查看一个索引
curl 127.0.0.1:9200/js_goods?pretty
创建一个索引
curl -v -X DELETE 127.0.0.1:9200/js_goods
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。