1. Create a library
PUT http://localhost:9200/secisland?pretty/
If the database is successfully built, it will return:
{
"acknowledged": true
}
2. Query the status of the library
http://localhost:9200/_cat/indices?v
Or check the status of the library in the Overview tab of the Head plugin
3. Insert data
请求:PUT http://localhost:9200/secisland/secilog/1/
parameter:
{
"computer":"secisland",
"message":"secisland is an security company!"
}
return value:
{
"_index": "secisland",
"_type": "secilog",
"_id": "1",
"_version": 1,
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"created": true
}
4. Modify the document
请求:POST http://localhost:9200/secisland/secilog/1/_update
parameter:
{
"doc":{
"computer":"secisland",
"message":"secisland is an security company! It provides log analysis products!"
}
}
return value:
{
"_index": "secisland",
"_type": "secilog",
"_id": "1",
"_version": 2,
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
}
}
5. Query documents
请求:GET http://localhost:9200/secisland/secilog/1/
return value:
{
"_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 documents
请求:DELETE http://localhost:9200/secisland/secilog/1/
return value:
{
"found": true,
"_index": "secisland",
"_type": "secilog",
"_id": "1",
"_version": 3,
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
}
}
7. Delete the library
Request: DELETE http://localhost:9200/secisland/
return value:
{
"acknowledged": true
}