has_parent里,怎么使用子节点的字段啊,就类似 mysql inner join on 多个字段相等
比如 search table1
{
"size": 0,
"query": {
"bool": {
"must": [
{
"terms": {
"a_id": [
1
]
}
},
{
"has_parent": {
"query": {
"bool": {
"must": [
{
"nested": {
"query": {
"bool": {
"must": [
{
"terms": {
"nested_field.a_id": [
1
]
}
}
]
}
},
"path": "nested_field"
}
}
]
}
},
"type": "table2"
}
}
]
}
}
}
原本table1 和table2 就用id关联成父子关系了,现在还想再用查询的时候,把他们的a_id 关联起来,elastic里不知道怎么实现
比如 search table1
{
"size": 0,
"query": {
"bool": {
"must": [
{
"terms": {
"a_id": [
1
]
}
},
{
"has_parent": {
"query": {
"bool": {
"must": [
{
"nested": {
"query": {
"bool": {
"must": [
{
"terms": {
"nested_field.a_id": [
1
]
}
}
]
}
},
"path": "nested_field"
}
}
]
}
},
"type": "table2"
}
}
]
}
}
}
原本table1 和table2 就用id关联成父子关系了,现在还想再用查询的时候,把他们的a_id 关联起来,elastic里不知道怎么实现
0 个回复