es用restful api 操作数据

1.在 es 中存储数据 

1.1

put

http://localhost:9200/blog/article/1

{"title":"titlename2","cluster_name":"elasticsearch2","nodes":"uDv0VoTBQwW-uhAINW53Mw","name":"Futurist","transport_address":"127.0.0.1:9300"}


返回

{"_index":"blog","_type":"article","_id":"1","_version":3,"_shards":{"total":2,"successful":1,"failed":0},"created":false}
1.2
标识符自动创建:

http://localhost:9200/blog/article/2

post

{"title":"titlename2","cluster_name":"elasticsearch2","nodes":"uDv0VoTBQwW-uhAINW53Mw","name":"Futurist","transport_address":"127.0.0.1:9300"}

返回

{"_index":"blog","_type":"article","_id":"2","_version":1,"_shards":{"total":2,"successful":1,"failed":0},"created":true}

2. 检索文档

http://localhost:9200/blog/article/2

{"_index":"blog","_type":"article","_id":"2","_version":1,"found":true,"_source":{"title":"titlename2","cluster_name":"elasticsearch2","nodes":"uDv0VoTBQwW-uhAINW53Mw","name":"Futurist","transport_address":"127.0.0.1:9300"}}


你可能感兴趣的:(es用restful api 操作数据)