问题
how can I use parent/child relationship in ElasticSearch-7
all my documents have _doc type
I want to implement something like the one shown below
// index = `order_item`
{
"ID": 1,
"Name": "Shoes",
"Price": 9.99,
"OrderID": 82
},
{
"ID": 2,
"Name": "Hat",
"Price": 19.99,
"OrderID": 82
}
// index = `order`
{
"ID": 82,
"Customer": "John Smith"
}
I want join these indices as below with parent/child relationship
order
{
"ID": 82,
"Customer": "John Smith",
"order-item": [
{
"ID": 1,
"Name": "Shoes",
"Price": 9.99,
},
{
"ID": 2,
"Name": "Hat",
"Price": 19.99,
}
]
}
or for each order_item
order-item
{
"ID": 2,
"Name": "Hat",
"Price": 19.99,
"Order": {
"ID": 82,
"Customer": "John Smith"
}
}
来源:https://stackoverflow.com/questions/66098816/parent-child-relationship-didnt-work-in-elasticsearch