Elasticsearch 基操
一、Elasticsearch介绍
二、curl 基本操作
参考:使用curl操作
新建 index :
curl -H "Content-Type: application/json" -X PUT 'localhost:9200/accounts' -d '
{
"mappings": {
"person": {
"properties": {
"user": {
"type": "text"
},
"title": {
"type": "text"
},
"desc": {
"type": "text"
}
}
}
}
}'
插入数据:
curl -H "Content-Type: application/json" -X PUT 'localhost:9200/accounts/person/1' -d '
{
"user": "张三",
"title": "工程师",
"desc": "数据库管理"
}'
curl -H "Content-Type: application/json" -X POST 'localhost:9200/accounts/person' -d '
{
"user": "李四",
"title": "工程师",
"desc": "系统管理"
}'