我将DBs包含此类文档
{
"id": "647e50f2-55dc-46ed-9020-13514fb49be2",
"FirstName": "Natalie",
"LastName": "Washington",
"Mobile": "532-6718861",
"Country": {
"id": "6d498123-97c6-48fc-afb6-b1c613e4f02b",
"Name": "Norway"
},
"Groups": [
{
"id": "2fd2d3e9-61d8-4942-8eb5-3ae58a4ac49e",
"Name": "Gaming",
"SubGroupList": [
{
"id": "15063cb9-df87-4fb8-9ecd-a430f1aa7d2e",
"Name": "Tom Clancy's Rainbow Six"
},
{
"id": "cca79f1a-a815-4305-8191-1a43a278e0d4",
"Name": "World of Warcraft "
},
{
"id": "1b412f1d-d82e-4670-a805-10efbd29e6c4",
"Name": "Dota 2"
},
{
"id": "e102101a-1613-4c92-9098-9dc0299f11a7",
"Name": "Fortnite"
},
{
"id": "d2862574-5639-4a87-8775-024bc166118c",
"Name": "League of Legends"
},
{
"id": "fc9f0327-f1a1-46c2-b5b3-6ce1667cf5a8",
"Name": "Counter-Strike"
}
]
},
{
"id": "909a9d52-8cdc-43a6-937a-3ef6902ce5c3",
"Name": "Action Sports",
"SubGroupList": [
{
"id": "7a56f256-10ec-45cc-b8b3-6cc0539d13c1",
"Name": "Kite Surf"
},
{
"id": "0cde0de0-207b-4129-867b-398fc2040ffd",
"Name": "Pakour"
},
{
"id": "4a89ac41-745b-4e8c-8d75-05d1a43a26da",
"Name": "Scooter"
},
{
"id": "079c07b4-11d4-4281-b3d7-9e0830e96688",
"Name": "BMX"
},
{
"id": "f90eb7d1-1680-4972-8814-15d404326a4a",
"Name": "Wakeboard"
},
{
"id": "1066bbf7-b743-4712-b6bf-fdaf5e11c1c6",
"Name": "MTB"
}
]
}
]
}
不言而喻,因为用户可以从事体育和游戏活动。但是我只希望游戏中的组,因为Fortnite是游戏的子组。所以我的问题是,如何在没有每个SubGroups类型的列的情况下进行这种层次结构?即使这样做,我也不确定如何将“组”列与子组列连接起来。
答案 0 :(得分:2)
仅当您将每个组建模为单独的文档时,才可能仅对属于特定组的子组进行处理。这是因为无论您使用展平还是Complex Types,过滤都会应用到整个文档的级别。因此,我的建议是针对这种特定情况单独索引组。