Elasticsearch 자주 사용하는 쿼리 명령 요약

Elasticsearch 자주 사용하는 쿼리 명령 요약


하나,_cat 작업
_cat 시리즈는elasticsearch 집단 상태를 조회하는 일련의 인터페이스를 제공합니다.너는 집행을 통해
curl -XGET localhost:9200/_cat
 _cat 
/_cat/allocation
/_cat/shards
/_cat/shards/{index}
/_cat/master
/_cat/nodes
/_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/plugins
/_cat/fielddata
/_cat/fielddata/{fields}
 , v, 

2:_cluster 시리즈
1. 쿼리 설정 클러스터 상태
curl -XGET localhost:9200/_cluster/health?pretty=true
pretty=true 
level=indices  
level=shards  
2、curl -XGET localhost:9200/_cluster/stats?pretty=true
 , CPU JVM 
3、curl -XGET localhost:9200/_cluster/state?pretty=true
 。 、 。
3、curl -XGET localhost:9200/_cluster/pending_tasks?pretty=true
 
3、 
 :

curl -XPUT localhost:9200/_cluster/settings -d ‘{
“persistent” : {
“discovery.zen.minimum_master_nodes” : 2
}
}’
transient  ,persistent 
4、curl -XPOST ‘localhost:9200/_cluster/reroute’ -d ‘xxxxxx’
 shard , http://zhaoyanblog.com/archives/687.html
5、 
 192.168.1.1 
curl -XPOST ‘http://192.168.1.1:9200/_cluster/nodes/_local/_shutdown’
curl -XPOST ‘http://localhost:9200/_cluster/nodes/192.168.1.1/_shutdown’
 
curl -XPOST ‘http://localhost:9200/_cluster/nodes/_master/_shutdown’
 
$ curl -XPOST ‘http://localhost:9200/_shutdown?delay=10s’
$ curl -XPOST ‘http://localhost:9200/_cluster/nodes/_shutdown’
$ curl -XPOST ‘http://localhost:9200/_cluster/nodes/_all/_shutdown’
delay=10s 10 

3:_nodes 시리즈
1. 조회 노드의 상태
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

4. 색인 작업
1、 
curl -XGET ‘http://localhost:9200/{index}/{type}/{id}’
2、 
curl -XPOST ‘http://localhost:9200/{index}/{type}/{id}’ -d’{“a”:”avalue”,”b”:”bvalue”}’
3、 
curl -XDELETE ‘http://localhost:9200/{index}/{type}/{id}’
4、 mapping
curl -XPUT http://localhost:9200/{index}/{type}/_mapping -d ‘{
“{type}” : {
“properties” : {
“date” : {
“type” : “long”
},
“name” : {
“type” : “string”,
“index” : “not_analyzed”
},
“status” : {
“type” : “integer”
},
“type” : {
“type” : “integer”
}
}
}
}’
5、 mapping
curl -XGET http://localhost:9200/{index}/{type}/_mapping
6、 

curl -XGET ‘http://localhost:9200/{index}/{type}/_search’ -d '{
“query” : {
“term” : { “user” : “kimchy” } //  “match_all”: {}
},
“sort” : [{ “age” : {“order” : “asc”}},{ “name” : “desc” } ],
“from”:0,
“size”:100
}
curl -XGET ‘http://localhost:9200/{index}/{type}/_search’ -d '{
“filter”: {“and”:{“filters”:[{“term”:{“age”:“123”}},{“term”:{“name”:“ ”}}]},
“sort” : [{ “age” : {“order” : “asc”}},{ “name” : “desc” } ],
“from”:0,
“size”:100
}

좋은 웹페이지 즐겨찾기