【ElasticSearch的点点滴滴】第一篇:GET(查询)相关操作

本博客参考官网文档及多篇网络博客,仅供各位博友参考。如有引用,请注明引用地址。


  1. 查询所有数据
GET _search
{
  "query": {
    "match_all": {}
  }
}
  1. 获取当前集群线程池使用情况
GET _cat/thread_pool?v
  1. 监控Fielddata 的使用
(1)按索引使用 indices-stats API :
GET /_stats/fielddata?fields=*
(2)按节点使用 nodes-stats API :
GET /_nodes/stats/indices/fielddata?fields=*
(3)按索引节点: 
GET /_nodes/stats/indices/fielddata?level=indices&fields=*
  1. 查看均衡过程进度
GET /_cat/recovery?active_only=true
(1)查看恢复
GET _cat/recovery
GET _cat/recovery/{index}
  1. 查看集群设置
GET _settings
  1. 查看lock memory是否设置成功
GET /_nodes?filter_path=**.mlockall
  1. 查看节点
GET /_nodes
curl -XGET 'http://localhost:9200/_nodes/stats?pretty=true' 
curl -XGET 'http://localhost:9200/_nodes/192.168.1.2/stats?pretty=true' 
curl -XGET 'http://localhost:9200/_nodes/process' 
curl -XGET 'http://localhost:9200/_nodes/_all/process' 
curl -XGET 'http://localhost:9200/_nodes/192.168.1.2,192.168.1.3/jvm,process' 
curl -XGET 'http://localhost:9200/_nodes/192.168.1.2,192.168.1.3/info/jvm,process'
curl -XGET 'http://localhost:9200/_nodes/192.168.1.2,192.168.1.3/_all'
curl -XGET 'http://localhost:9200/_nodes/hot_threads'
查询节点设置
curl -XGET http://172.168.1.203:9200/_nodes/stats
  1. 节点统计信息
curl -XGET 'http://172.168.1.201:9200/_nodes/stats'
curl -XGET 'http://172.168.1.201:9200/_nodes/stats/os'
curl -XGET 'http://172.168.1.201:9200/_nodes/stats/process'
curl -XGET http://172.168.1.201:9200/_nodes/stats/indices/fielddata?fields=*
hot threads api,高消耗的线程在做什么
curl -XGET 'http://172.168.1.201:9200/_nodes/hot_threads'
  1. 查看别名
GET _aliases
GET _cat/aliases 
GET _cat/aliases/{alias}
  1. 查看segment
GET _cat/segments?v
GET _cat/segments 
GET _cat/segments/{index}
  1. 查看mapping
查看指定type
GET _mapping/t_vitualacc
查看所有的mapping
GET _mapping
获取mapping 
curl -XGET http://localhost:9200/{index}/{type}/_mapping
  1. 查看集群健康状态
GET _cat/health?v
查看集群健康状态,索引级别
GET _cluster/health?level=indices
查看集群健康状态,分片级别
GET _cluster/health?level=shards
集群状态 
curl -XGET localhost:9200/_cluster/health?pretty=true 
pretty=true表示格式化输出 
level=indices 表示显示索引状态 
level=shards 表示显示分片信息
  1. 查看节点分布
GET  _cat/nodeattrs
  1. 查看分片
GET _cat/shards?v
GET _cat/shards 
GET _cat/shards/{index}
查看分片恢复
GET _cat/recovery?v&h=i,s,t,ty,st,fp,bp,shost,thost
  1. 查看索引
GET _cat/indices?v
GET _cat/indices 
GET _cat/indices/{index}
  1. 查看存储分布
GET _cat/allocation/_master
GET _cat/allocation
  1. 查看es集群文档总数
GET /_cat/count 
GET /_cat/count/{index}
  1. 查看(主/从)节点
GET /_cat/master
GET /_cat/nodes
  1. 查看索引
GET _cat/indices
GET _cat/indices/dc_test_event1*
curl -XGET http://172.168.1.201:9200/_cat/indices
curl -XGET http://172.168.1.201:9200/_cat/indices/dc_test_object1*
  1. 查看集群正在执行的任务
GET _cat/pending_tasks
curl -XGET localhost:9200/_cluster/pending_tasks?pretty=true
查询集群等待任务
GET _cluster/pending_tasks
curl -XGET 'http://172.168.1.201:9200/_cluster/pending_tasks'
获取当前查询任务列表
GET _tasks
curl -XGET 'http://172.168.1.201:9200/_tasks'
  1. 查看线程池
GET _cat/thread_pool
  1. 查看插件
GET  _cat/plugins
  1. 查看fielddata
GET _cat/fielddata
GET _cat/fielddata/{fields}
  1. 显示集群系统信息
包括CPU JVM等等
curl -XGET 172.168.1.199:9200/_cluster/stats?pretty=true
  1. 集群的详细信息
包括节点、分片等
curl -XGET 172.168.1.199:9200/_cluster/state?pretty=true
  1. 获取文档
curl -XGET 'http://localhost:9200/{index}/{type}/{id}'
构造数据
curl -XPOST 'http://localhost:9200/{index}/{type}/{id}' –d '{"a":"avalue","b":"bvalue"}'
  1. 查看索引设置
GET index_test/_settings
  1. 分词器
GET _analyze
{
  "analyzer": "ik_max_word",
  "text": "中华人民\\n共和国"
}
GET _analyze
{
  "analyzer": "ik_smart",
  "text": "中华人民\\n共和国"
}
分词器分词
GET /ipearl_2501_event_20181023_001/_analyze
{
  "analyzer": "text_analyzer",
  "text": "13915922365"
}
GET _analyze
{
  "analyzer": "standard",
  "text": "13915922365"
}
索引自定义的分词器
GET test/_analyze
{
  "analyzer": "text_stop_analyzer",
  "text": "illegal argument exception"
}
ES还内置了分词器和过滤器
[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-tokenizers.htmlstandard]
(1)edge_ngram
(2)keyword
(3)letter
(4)lowercase
(5)ngram 
(6)whitespace 
(7)pattern 
(8)uax_email_url 
(9)path_hierarchy 
(10)ascii folding 
(11)length 
(12)lowercase 
(13)uppercase 
(14)nGram 
(15)edge_ngram 
(16)porter_stem 
(17)shingle 
(18)stop 
(19)word_delimiter 
(20)stemmer 
(21)stemmer_override 
(22)keyword_marker 
(23)keyword_repeat 
(24)kstem 
(25)snowball 
(26)phonetic 
(27)synonym 
(28)reverse 
(29)elision 
(30)truncate 
(31)unique 
(32)pattern_capture 
(33)pattern_replace 
(34)trim 
(35)limit
(36)hunspell 
(37)common_grams 
(38)normalization 
(39)delimited_payload 
(40)keep_words
  1. 清除缓存
GET _cache/clear
  1. 查看路由
GET /test/_routing
  1. 查看快照
GET _snapshot/_all
查询快照
GET /_snapshot/share_data/snapshot_5
查询快照的状态
GET _snapshot/share_data/snapshot_1/_status
恢复快照
GET ipearl_test_event_20170101_002/_recovery
  1. 查询某字段的准确值
GET dtest/_search?q=varchar_id:1,silio
GET twitter/tweet/_search?q=user:kimchy
  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值