版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_36381640/article/details/82416040
1.获取文档的mapping
GET /net_log/user/_mapping
2.自定义mapping
PUT /net_log2
{
"settings":{
"number_of_shards":3,
"number_of_replicas":0
},
"mappings":{
"user1":{
"properties":{
"name":{"type":"text"},
"address":{"type":"text"},
"age":{"type":"integer"},
"birthday":{"type":"date"}
}
}
}
}
执行结果:
{
"acknowledged": true,
"shards_acknowledged": true,
"index": "net_log2"
}
//存数据
POST /net_log3/user1/1
{
"name":"Marray",
"age":2,
"address":"MarrayMarray",
"birthday":"2018-02-03",
"interests":"lllll"
}