Elasticsearch curl操作
_cat操作
curl localhost:9200/_cat =^.^= /_cat/allocation /_cat/shards /_cat/shards/{index} /_cat/master /_cat/nodes //獲得集羣的所有節點 /_cat/indices //獲得集羣所有的index /_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}
索引操作
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}’
刪除數據
簡單刪除(根據id)
curl -XDELETE 'http://localhost:9200/{index}/{type}/{id}?timeout=5m'
按照查詢條件刪除數據
curl -XPOST 'localhost:9200/{index}/{type}/_delete_by_query?pretty' -d' { "query": { "query_string": { "message": "some message" } } }'