How can i fetch nested object in elastic search ?
{
"_index": "userinfo",
"_type": "userdetails",
"_id": "2",
"_score": 1,
"_source": {
"id": "2",
"name": "Robert Mark",
"age": 42,
"email": "[email protected]",
"userType": {
"id": "3",
"type": "End User"
},
"hobbies": [
{
"id": "3",
"description": "Writing Books"
},
{
"id": "4",
"description": "Gardening"
}
]
}
}
这是我的json结构,我想获取所有记录中爱好描述为“ Gardening”的记录。
我是弹性搜索的新手,如果有人知道,请为此提供帮助。
“ description”:“园艺”
这是您的查询:
{
"query": {
"nested": {
"path": "hobbies",
"query": {
"match": {
"hobbies.description": "Gardening"
}
}
}
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句