elasticsearch 通过curl的操作
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 這三種狀態。
- Green :?everything is good(一切都很好)(所有功能正常)
- 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?
總結
以上是生活随笔為你收集整理的elasticsearch 通过curl的操作的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: elasticsearch-7.3安装
- 下一篇: 编译问题 文件查找失败: ‘vant‘