我一直在试图弄清楚如何在ElasticSearch中建模我的数据以完成基于搜索的嵌套对象过滤。
这是我现有的数据模式:
[
{
"job":{
"jobId":"d2f462c1-3015-460e-aa4f-3e5ed8969b4a",
"jobName":"2651",
"otherStuff":"my stuff",
"order":[
{
"description":"D-Style, To Match",
"orderID":"ad86b512-6da3-407d-931d-d20e8717650f",
"poNumber":"2651-1"
},
{
"description":"Switch-Style, To Match",
"orderID":"3d86b512-6da3-407d-931d-d20e8717650f",
"poNumber":"some data"
}
]
}
}
]
我想要完成的是:
因此,如果我搜索“某些数据”,我希望在结果集中看到这个:
[
{
"job":{
"jobId":"d2f462c1-3015-460e-aa4f-3e5ed8969b4a",
"jobName":"2651",
"otherStuff":"my stuff",
"order":[
{
"description":"Switch-Style, To Match",
"orderID":"3d86b512-6da3-407d-931d-d20e8717650f",
"poNumber":"some data"
}
]
}
}
]
我研究过嵌套对象类型以及父/子关系。我不知道如何只用1个查询来完成这个。谢谢你的帮助!