Elasticsearch through the operation of curl

1:curl

curl -h to view the meaning of the request parameters
-v to display the requested information
-X option to specify other protocols

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 

check run

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"
}

cluster health

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%

When requesting cluster health, you will get three states: green, yellow, or red.

  • Green : everything is good (everything is good) (everything is functional)
  • Yellow: all data is available, but some replicas are not yet allocated (all functions are normal)
  • Red : Some data is not available (partially functional)

node list

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

View all indexes
curl 127.0.0.1:9200/_cat/indices?v
Create an index
curl -X PUT "localhost:9200/js_goods?pretty"
View an index
curl 127.0.0.1:9200/js_goods?pretty
Create an index
curl -v -X DELETE 127.0.0.1:9200/js_goods 

Guess you like

Origin blog.csdn.net/wind520/article/details/120799790