elasticsearch nested 增删改查
·
增
PUT /precedent/_mapping
{
"properties": {
"clean_process": {
"properties": {
"stand": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"form": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"bert": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
删
删除文档某个属性
POST /precedent/_update/5e9551f2cc0e3e3394e8e9cd
{
"script" : "ctx._source.remove(\"clean_process.bert\")"
}
改
更新 不用全部写全,只会更新对应的 nested 的某个元素
POST /precedent/_update/5e9551f2cc0e3e3394e8e9cd
{
"doc" : {
"clean_process":{
"bert" : 0
}
}
}
查
# 查询 nested 字段 exists 的count
GET /precedent/_count
{
"query": {
"nested": {
"path": "zyjd",
"query": {
"exists": {
"field":"zyjd"
}
}
}
}
}
更多推荐
所有评论(0)