天天看点

elasticsearch-curl-基础命令

1,查看集群节点信息

集群的任意节点上都可以查询的 (master、date)
curl -XGET http://10.4.7.11:9200/_nodes/process?pretty
           

2,查询集群的健康状态

curl http://10.4.7.11:9200/_cluster/health?pretty
curl http://10.4.7.11:9200/_cluster/health/'新蔡'?pretty
           

3,查看集群节点属性

curl http://10.4.7.11:9200/_cat/
=^.^=
/_cat/allocation
/_cat/shards
/_cat/shards/{index}
/_cat/master
/_cat/nodes
/_cat/tasks
/_cat/indices
/_cat/indices/{index}
/_cat/segments
/_cat/segments/{index}
/_cat/count
/_cat/count/{index}
/_cat/recovery
/_cat/recovery/{index}
/_cat/health
/_cat/pending_tasks
/_cat/aliases
/_cat/aliases/{alias}
/_cat/thread_pool
/_cat/thread_pool/{thread_pools}
/_cat/plugins
/_cat/fielddata
/_cat/fielddata/{fields}
/_cat/nodeattrs
/_cat/repositories
/_cat/snapshots/{repository}
/_cat/templates
/_cat/ml/anomaly_detectors
/_cat/ml/anomaly_detectors/{job_id}
/_cat/ml/trained_models
/_cat/ml/trained_models/{model_id}
/_cat/ml/datafeeds
/_cat/ml/datafeeds/{datafeed_id}
/_cat/ml/data_frame/analytics
/_cat/ml/data_frame/analytics/{id}
/_cat/transforms
/_cat/transforms/{transform_id}
           

4,查看集群索引

curl http://10.4.7.11:9200/_cat/shards
curl http://10.4.7.11:9200/_cat/shards|grep -n '新蔡'
           

索引模板

1,用curl创建一个索引模板

curl -H "Content-Type: application/json" -DPUT 'http://10.4.7.11:9200/_template/filebeat' -d '{
"template": "filebeat*",
"settings": {
  "number_of_shards": 5,
   "number_of_replicas": "2"
   }
}'
           

2,查看索引模板

a,用火狐浏览器查看

http://10.4.7.11:9200/_template/filebeat

elasticsearch-curl-基础命令

b,用curl查看

curl -XGET http://10.4.7.11:9200/_template/filebeat
{"acknowledged":true}
           
elasticsearch-curl-基础命令

继续阅读