user字段映射为nested类型,而不是默认的object类型
curl -XGET 'localhost:9200/my_index/_search?pretty' -H 'Content-Type: application/json' -d'
{
"query": {
"nested": {
"path": "user",
"query": {
"bool": {
"must": [
{ "match": { "user.first": "Alice" }},
{ "match": { "user.last": "Smith" }}
]
}
}
}
}
}
GET uat-buriedpoint_xfs.com-2021-11/_search
{
"query": {
"bool": {
"must": [
{ "match": { "body.buriedPointInfo.userInfo.sid": "1b5bd8a4787445b1a8ab7061d24e98d5" }},
{ "match": { "body.buriedPointInfo.requestInfo.url": "/auth/user/getUserRoles" }}
]
}
}
}
本文探讨了如何使用nested查询结构在Elasticsearch中查找特定用户(user字段)同时匹配first和last名,以Alice Smith为例,展示了查询结构和实际操作方法。
1643

被折叠的 条评论
为什么被折叠?



