Elasticsearch基本命令

检查集群运行情况:    GET ->   localhost:9200/_cat/health?v
查看集群节点列表:    GET ->   localhost:9200/_cat?nodes
查看所有指数:           GET ->   localhost:9200/_cat?indices?v
 
创建索引:                  PUT ->  localhost:9200/index?pretty    pretty:打印JSON相应结果
删除索引:                  DELETE ->    localhost:9200/index?pretty
向索引中添加内容:    PUT ->   localhost:9200/inde/_doc/1?pretty    JSON数据:{"name": "WangJunce"}    //如果索引之前不存在,则自动创建索引
向索引中添加内容(不指定ID,会自动随机生成):    POST->   localhost:9200/inde/_doc?pretty    JSON数据:{"name": "noId"}
修改索引中某个内容: PUT ->   localhost:9200/index/_doc/1?pretty  JSON数据:{"name":"wangjunce_update"}
更新文档:                  POST -> localhost:9200/index/_update/1?pretty    JSON数据:{"doc": {"name": "post_update", "age": "23"}}
检索存入索引的文档: GET ->   localhost:9200/index/_doc/1?pretty
 
批量操作索引文档:    POST -> localhost:9200/index/_bulk?pretty    JSON数据:{"index":{"_id":"1"}}{"name": "John Doe" }{"index":{"_id":"2"}}{"name": "Jane Doe" }  (最后要加/n换行,不然会报错;也可以进行修改删除等操作)
 
原文地址:https://www.cnblogs.com/gqymy/p/11125667.html