Elasticsearch 入门 - Exploring Your Cluster

The REST API

Cluster Health ( http://localhost:9200/

curl -X GET "localhost:9200/_cat/health?v"

List Nodes

curl -X GET "localhost:9200/_cat/nodes?v"

List All Indices

curl -X GET "localhost:9200/_cat/indices?v"

Create an Index

使用PUT谓词创建一个名为 customer 的索引

curl -X PUT "localhost:9200/customer?pretty"

再次查看索引:

curl -X GET "localhost:9200/_cat/indices?v"

Index and Query a Document

curl -X PUT "localhost:9200/customer/_doc/1?pretty" -H 'Content-Type: application/json' -d'
{
  "name": "John Doe"
}
'

查询文档:

curl -X GET "localhost:9200/customer/_doc/1?pretty"

Delete an Index

使用谓语动词 DELETE 删除一个索引

curl -X DELETE "localhost:9200/customer?pretty"

再次查看索引:

curl -X GET "localhost:9200/_cat/indices?v"
posted @ 2019-02-23 15:51  隔壁老王python  阅读(166)  评论(0编辑  收藏  举报