DELETE blog
#设置blog的Mapping
PUT /blog
{
"mappings": {
"properties": {
"content":{
"type": "text"
},
"time":{
"type": "date"
},
"user":{
"properties": {
"city":{
"type":"text"
},
"userid":{
"type":"long"
},
"username":{
"type":"keyword"
}
}
}
}
}
}
#插入一条blog信息
PUT blog/_doc/1
{
"content":"I like Elasticsearch",
"time":"2019-01-01T00:00:00",
"user":{
"userid":1,
"username":"Jack",
"city":"Shanghai"
}
}
#查询blog信息
POST blog/_search
{
"query": {
"bool": {
"must": [
{"match": { "content": "Elasticsearch"}},
{"match":