Hi All,
I have an index which contains a nested object. I would like to return multiple parent documents for each object matched in the nested object.
For example:
Index Details:
"settings": {
"number_of_shards": 1
},
"mappings": {
"_doc": {
"properties": {
"OrderId": {
"type": "text"
},
"Product": {
"type": "nested",
"properties": {
"ProductId": {
"type": "long"
},
"ProductName": {
"type": "text"
}
}
}
}
}
}
}
{
"orderId" :1,
"Product: :[
{
"ProductId" : 1,
"ProductName" : "LG1 TV",
"Quantity" : 2
},
{
"ProductId" : 2,
"ProductName" : "Sony1 TV",
"Quantity" : 2
},
{
"ProductId" : 1,
"ProductName" : "LG1 TV",
"Quantity" : 5
},
]
}
{
"query": {
"nested": {
"path": "Product",
"query": {
"match": {"Product.Productname" : "Public1"}
}
}
}
}
Now i want to return order details that matched LG1 TV. I would like to have two rows in this case in the output because there are two nested objects have a match.