索引的CRUD2.0

 1 #创建product索引:
 2 PUT /product?pretty
 3 #删除product索引:
 4 DELETE /product?pretty
 5 #查询product索引下的数据信息:
 6 GET /product/_search
 7 #查询所有索引的信息:
 8 GET _cat/indices?v
 9 #获取id为1的数据
10 GET /product/_doc/1
11 #插入数据
12 PUT /product/_doc/1
13 {
14   "name":"xiaomi phone",
15   "desc":"shouji zhong de zhandouji",
16   "price":3999,
17   "tags":["xingjibi","fashao","buka"]
18 }
19 PUT /product/_doc/2
20 {
21   "name":"xiaomi nfc phone",
22   "desc":"zhichi quangongneng nfc,shouji zhong de jianjiji",
23   "price":4999,
24   "tags":["xingjibi","fashao","gongjiaoka"]
25 }
26 PUT /product/_doc/3
27 {
28   "name":"nfc phone",
29   "desc":"shouji zhong de hongzhaji",
30   "price":2999,
31   "tags":["xingjibi","fashao","menjinka"]
32 }
33 PUT /product/_doc/4
34 {
35   "name":"xiaomi erji",
36   "desc":"erji zhong de huangmenji",
37   "price":999,
38   "tags":["low","bufangshui","yinzhicha"]
39 }
40 PUT /product/_doc/5
41 {
42   "name":"hongmi erji",
43   "desc":"erji zhong de kendeji",
44   "price":399,
45   "tags":["lowbee","xuhangduan","zhiliangx"]
46 }
47 #修改指定字段的值
48 POST /product/_update/1
49 {
50   "doc":{
51     "price":59999
52   }
53 }
54 #删除指定数据
55 DELETE product/_doc/1

 

上一篇:java枚举enum详解


下一篇:java架构之路-(分布式zookeeper)zookeeper集群配置和选举机制详解