码迷,mamicode.com
首页 > Windows程序 > 详细

Elasticsearch常用API总结

时间:2018-07-12 13:02:06      阅读:521      评论:0      收藏:0      [点我收藏+]

标签:change   class   文档   ESS   ping   常用   bsp   arp   last   

1、查看集群设置

GET /_cluster/settings

2、设置allocation

#禁止分片分配
put _cluster/settings
{
"transient":{
"cluster.routing.allocation.enable": "none"
}
}
#允许分片分配

put /_cluster/settings
{
"transient":{
"cluster.routing.allocation.enable": "all"
}
}

3、删除索引

# kibana dev tools
delete {index_name}
eg:delete ngxrelate-2018_05_26
# curl方式
curl -XDELETE -u elastic:changeme  localhost:9200/nginxaccess-2017_09?pretty

4、查看未分配分片(unassigned shard)

# curl方式
curl  http://10.80.17.154:9200/_cat/shards | grep -i unassigned

5、查看索引

# kibana dev tools
GET /_cat/indices?v
# curl 方式
curl -u elastic:changeme ‘http://localhost:9200/_cat/indices?v‘

6、查看模板(template)

# kibana dev tools
GET /_template/nginxaccess?pretty
# curl方式
curl -u elastic:changeme http://localhost:9200/_template/nginxaccess?pretty

7、删除模板

# kibana dev tools
DELETE /_template/nginxaccess
# curl方式
curl -XDELETE -u elastic:changeme http://localhost:9200/_template/nginxaccess

8、加载模板

curl -u elastic:changeme -XPUT http://localhost:9200/_template/nginxaccess -d @nginxaccess.json 

9、查看mapping

curl -u elastic:changeme http://localhost:9200/{INDEX_NAME}/_mapping/?pretty

10、查看集群的状态

# kibana dev tools
GET /_cat/health?v&ts=false&pretty
# curl 
curl -u elastic:changeme http://localhost:9200/_cat/health?v&ts=false&pretty

11、计算集群中文档数量

curl -u elastic:changeme http://10.80.17.154:9200/_count?pretty -d {"query": {"match_all": {}}}

 

 

  

 

Elasticsearch常用API总结

标签:change   class   文档   ESS   ping   常用   bsp   arp   last   

原文地址:https://www.cnblogs.com/sailq21/p/9298109.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!