码迷,mamicode.com
首页 > 其他好文 > 详细

Elasticsearch常用基础操作

时间:2017-12-04 20:39:45      阅读:178      评论:0      收藏:0      [点我收藏+]

标签:post   extern   ane   doc   oca   search   类型   customer   cat   

1、获得集群中的节点列表:

curl ‘localhost:9200/_cat/nodes?v‘

2、获得所有索引:

curl ‘localhost:9200/_cat/indices?v‘

3、创建指定文档,并索引到指定索引和类型

#                  索引  类型
1 curl -XPUT ‘localhost:9200/customer/external/1?pretty‘ -d ‘ 2 { 3 "name": "John Doe" 4 }‘

4、取出指定文档

curl -XGET ‘localhost:9200/customer/external/1?pretty‘

5、删除指定文档

curl -XDELETE ‘localhost:9200/customer/external/2?pretty‘ 

6、删除指定索引

curl -XDELETE ‘localhost:9200/customer?pretty‘

7、修改指定文档——直接使用添加的方式“-d”指定覆盖

1 curl -XPUT ‘localhost:9200/customer/external/1?pretty‘ -d ‘
2             {
3               "name": "John Doe"
4             }‘

8、更新文档

1 curl -XPOST ‘localhost:9200/customer/external/1/_update?pretty‘ -d ‘
2         {
3           "doc": { "name": "Jane Doe" }
4         }‘

Elasticsearch常用基础操作

标签:post   extern   ane   doc   oca   search   类型   customer   cat   

原文地址:http://www.cnblogs.com/hcy-fly/p/7978520.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!