PUT /my_index/my_type/1 { "my_field" : "my_value" } PUT /my_index/my_type { … } PUT /my_index/my_type/1/_create { … }
GET /my_index/my_type/0
DELETE /my_index/my_type/0
POST /my_index/my_type/1/_update { … }
GET /_mget { "docs" : [ { "_index" : "my_index", "_type" : "my_type", … } ] } GET /my_index/_mget { "docs" : [ { "_type" : "my_type", … } ] } GET /my_index/my_type/_mget { "docs" : [ { … } ] }
POST /my_index/_delete_by_query { "query": { "match": { … } } }
POST /my_index/_update_by_query?conflicts=proceed POST /my_index/_update_by_query?conflicts=proceed { "query": { "term": { "my_field": "my_value" } } } POST /my_index1,my_index2/my_type1,my_type2/_update_by_query
POST /_reindex { "source": { "index": "old_index" }, "dest": { "index": "new_index" } }
GET /my_index/my_type/_search?q=my_field:my_field GET /my_index/my_type/_search { "query" : { "term" : { "my_field" : "my_value" } } }
GET /my_index/_search_shards
GET /my_index/my_type/_count?q=my_field:my_value GET /my_index/my_type/_count { "query" : { "term" : { "my_field" : "my_value" } } }
GET /my_index/my_type/_validate?q=my_field:my_value GET /my_index/my_type/_validate { "query" : { "term" : { "my_field" : "my_value" } } }
GET /my_index/my_type/0/_explain GET /my_index/my_type/0/_explain?q=message:search
GET /_search { "profile": true, "query" : { … } }
GET /_field_stats GET /my_index/_field_stats GET /my_index1,my_index2/_field_stats
PUT /my_index { "settings" : { … } }
DELETE /my_index DELETE /my_index1,my_index2 DELETE /my_index* DELETE /_all
GET /my_index GET /my_index* GET my_index/_settings,_mappings
HEAD /my_index
POST /my_index/_close POST /my_index/_open
POST /my_index/_rollover { "conditions": { … } }
PUT /my_index/_mapping/new_type { "properties": { "my_field": { "type": "text" } } }
GET /my_index/_mapping/my_type/field/my_field GET /my_index1,my_index2/_mapping/my_type/field/my_field GET /_all/_mapping/my_type1,my_type2/field/my_field1,my_field2 GET /_all/_mapping/my_type1*/field/my_field*
HEAD /my_index/_mapping/my_type
POST /_aliases { "actions" : [ { "add" : { "index" : "my_index", "alias" : "my_alias" } } ] } POST /_aliases { "actions" : [ { "add" : { "index" : ["index1", "index2"] , "alias" : "another_alias" } } ] }
POST /_aliases { "actions" : [ { "remove" : { "index" : "my_index", "alias" : "my_old_alias" } } ] }
PUT /my_index/_settings { … }
GET /my_index/_settings
GET /_analyze { "analyzer" : "standard", "text" : "this is a test" }
PUT /_template/my_template { … }
DELETE /_template/my_template
GET /_template/my_template
HEAD /_template/my_template
GET /_stats GET /my_index1/_stats GET /my_index1,my_index2/_stats GET /my_index1/_stats/flush,merge
GET /_segments GET /my_index1/_segments GET /my_index1,my_index2/_segments
GET /_recovery GET /my_index1/_recovery GET /my_index1,my_index2/_recovery
GET /_shard_stores GET /my_index1/_shard_stores GET /my_index1,my_index2/_shard_stores
POST /_cache/clear POST /my_index/_cache/clear POST /my_index1,my_index2/_cache/clear
POST /_refresh POST /my_index/_refresh POST /my_index1,my_index2/_refresh
POST /_flush POST /my_index/_flush POST /my_index1,my_index2/_flush
POST /_forcemerge POST /my_index/_forcemerge POST /my_index1,my_index2/_forcemerge
GET /_cat/aliases?v GET /_cat/aliases/my_alias?v
GET /_cat/allocation?v
GET /_cat/count?v GET /_cat/count/my_index?v
GET /_cat/fielddata?v GET /_cat/fielddata/my_field1,my_field2?v
/_cluster/health
GET /_cat/health?v GET /_cat/health?v&ts=0
GET /_cat/indices?v GET /_cat/indices?v&health=yellow GET /_cat/indices/my_index*?v&health=yellow
GET /_cat/master?v
GET /_cat/nodeattrs?v GET /_cat/nodeattrs?v&h=name,id,pid,ip
GET /_cat/nodes?v GET /_cat/nodes?v&h=name,id,pid,ip
/_cluster/pending_tasks
GET /_cat/pending_tasks?v
GET /_cat/plugins?v GET /_cat/plugins?v&h=name,id,pid,ip
GET /_cat/recovery?v GET /_cat/recovery?v&h=name,id,pid,ip
GET /_cat/repositories?v
GET /_cat/thread_pool?v GET /_cat/thread_pool?v&h=id,pid,ip
GET /_cat/shards?v GET /_cat/shards/my_index?v GET /_cat/shards/my_ind*?v
_segments
GET /_cat/segments?v GET /_cat/segments/my_index?v GET /_cat/segments/my_index1,my_index2?v
/_cat/snapshots/my_repo?v
GET /_cat/templates?v GET /_cat/templates/my_template GET /_cat/templates/my_template*
GET /_cluster/health GET /_cluster/health/my_index1 GET /_cluster/health/my_index1,my_index2
GET /_cluster/state GET /_cluster/state/version,nodes/my_index1 GET /_cluster/state/version,nodes/my_index1,my_index2 GET /_cluster/state/version,nodes/_all
GET /_cluster/stats GET /_cluster/stats?human&pretty
GET /_cluster/pending_tasks
GET /_cluster/reroute { … }
GET /_cluster/settings { "persistent" : { … }, "transient" : { … } }
GET /_nodes/stats GET /_nodes/my_node1,my_node2/stats GET /_nodes/127.0.0.1/stats GET /_nodes/stats/indices,os,process
GET /_nodes GET /_nodes/my_node1,my_node2 GET /_nodes/_all/indices,os,process GET /_nodes/indices,os,process GET /_nodes/my_node1,my_node2/_all
GET /_tasks GET /_tasks?nodes=my_node1,my_node2 GET /_tasks?nodes=my_node1,my_node2&actions=cluster:*
GET /_nodes/hot_threads GET /_nodes/hot_threads/my_node GET /_nodes/my_node1,my_node2/hot_threads
GET /_cluster/allocation/explain GET /_cluster/allocation/explain { "index": "myindex", "shard": 0, "primary": false }
本文转载自:ElasticSearch API cheatsheet