1. 创建库
PUT http://localhost:9200/secisland?pretty/
建库成功则返回:
{
"acknowledged": true
}
2. 查询库的状态
http://localhost:9200/_cat/indices?v
或者在Head插件里概览页签中查看库的状态
3. 插入数据
请求:PUT http://localhost:9200/secisland/secilog/1/
参数:
{
"computer":"secisland",
"message":"secisland is an security company!"
}
返回值:
{
"_index": "secisland",
"_type": "secilog",
"_id": "1",
"_version": 1,
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"created": true
}
4. 修改文档
请求:POST http://localhost:9200/secisland/secilog/1/_update
参数:
{
"doc":{
"computer":"secisland",
"message":"secisland is an security company! It provides log analysis products!"
}
}
返回值:
{
"_index": "secisland",
"_type": "secilog",
"_id": "1",
"_version": 2,
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
}
}
5. 查询文档
请求:GET http://localhost:9200/secisland/secilog/1/
返回值:
{
"_index": "secisland",
"_type": "secilog",
"_id": "1",
"_version": 2,
"found": true,
"_source": {
"computer": "secisland",
"message": "secisland is an security company! It provides log analysis products!"
}
}
6. 删除文档
请求:DELETE http://localhost:9200/secisland/secilog/1/
返回值:
{
"found": true,
"_index": "secisland",
"_type": "secilog",
"_id": "1",
"_version": 3,
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
}
}
7. 删除库
请求: DELETE http://localhost:9200/secisland/
返回值:
{
"acknowledged": true
}