安装postman
增
put http://localhost:9200/blog/ariticle/1
{
"title":"New version of Elasticsearch released!",
"content":"Version 2.0 released today!"
}
结果
{
"_index": "blog",
"_type": "ariticle",
"_id": "1",
"_version": 6,
"result": "created",
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"_seq_no": 7,
"_primary_term": 1
}
注意
- 操作时如果index、type、id等不存在则会自动创建,如果这条id的数据已经存在则是更新这条数据
- 如果不指定 Id,需改为POST 请求,就会随机生成id 例如:
post http://localhost:9200/blog/ariticle
{
"_index": "blog",
"_type": "ariticle",
"_id": "xFjzbX8B_fwVMtrHLk44",(随机的id)
"_version": 1,
"result": "created",
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"_seq_no": 11,
"_primary_term": 1
}
删
delete http://localhost:9200/blog/ariticle/1
结果
查
get http://localhost:9200/blog/ariticle/1
结果
{
"_index": "blog",
"_type": "ariticle",
"_id": "1",
"_version": 3,
"_seq_no": 2,
"_primary_term": 1,
"found": true,
"_source": {
"title": "New version of Elasticsearch released!",
"content": "Version 2.0 released today!"
}
}