目录
fieldType详见:Field data types | Elasticsearch Guide [8.3] | Elastic
PUT person
{
"settings": {
"number_of_shards": 5,
"number_of_replicas": 2
},
"mappings": {
"properties": {
"name":{
"type": "text"
},
"age":{
"type": "integer"
},
"sex":{
"type": "integer"
},
"birth":{
"type": "date"
}
}
}
}
GET person
删除索引
DELETE person
PUT person/_doc/1
{
"name":"zhangsan",
"age":18,
"birth":"2022-11-11",
"address":"杭州"
}
POST person/_doc
{
"name":"lisi",
"age":18,
"birth":"2021-11-11",
"address":"杭州"
}
PUT _bulk
{"index":{"_index":"person","_id":"4"}}
{"doc":{"name":"jack2"}}
{"index":{"_index":"person","_id":"3"}}
{"doc":{"name":"jack3"}}查询
GET /person/_search
{
"query": {
"match_all": {}
}
}
POST /person/_doc/3
{
"email":"11@qq.com"
}
POST person/_update/1
{
"doc":{
"name":"rose"
}
}
#批量修改
POST _bulk
{"update":{"_index":"person","_id":"1"}}
{"doc":{"name":"张三"}}
{"update":{"_index":"person","_id":"2"}}
{"doc":{"name":"张三1"}}
{"update":{"_index":"person","_id":"3"}}
{"doc":{"name":"张三2"}}
DELETE person/_doc/4
PUT _bulk
{"delete":{"_index":"person","_id":"1"}}
{"delete":{"_index":"person","_id":"2"}}
查询操作有很多种。太长换下篇博客专门写